function fillpdf_pdftk_check in FillPDF 7
Same name and namespace in other branches
- 7.2 fillpdf.module \fillpdf_pdftk_check()
Test whether the pdftk path is valid.
Parameters
string $pdftk_path: The path to test.
Return value
bool TRUE if the path is the pdftk binary, FALSE otherwise.
3 calls to fillpdf_pdftk_check()
- FillPdfMergeTestCase::testPdftkPdfMerging in tests/
FillPdfMergeTestCase.test - Tests PDF merging using a local install of pdftk.
- fillpdf_execute_parse in ./
fillpdf.module - Utility to allow other functions to parse PDFs.
- fillpdf_settings_validate in ./
fillpdf.admin.inc
File
- ./
fillpdf.module, line 2065
Code
function fillpdf_pdftk_check($pdftk_path = 'pdftk') {
// An empty value means we should leave it to the PATH.
if (empty($pdftk_path)) {
$pdftk_path = 'pdftk';
}
$output = array();
$status = NULL;
exec($pdftk_path . ' --version', $output, $status);
$output = implode("\n", $output);
// Check the exit status.
if (in_array($status, array(
126,
127,
))) {
return FALSE;
}
elseif (!strpos($output, 'pdftk')) {
return FALSE;
}
return TRUE;
}