Execution of PDFTk from PHP script is failing with error cod
Posted: Thu Aug 12, 2010 3:27 am
I am trying to Fill in a PDF from PHP script. I am following the article by Sid Steward at the following URL: http://www.mactech.com/articles/mactech ... index.html.
I have configured PDFTk package on CentOS linux distribution and I am able to execute the pdftk from the command prompt and it merges the FDF form with the PDF and successfully generates the flattened(Filled) PDF. I am using following command to test the Pdftk using shell.
But When try to execute a similar command through PHP, I am getting the error. The passthru command is failing with error code 11. Following is the php code I am using to execute the command:
The $fdf_fn above has the FDF file name. The form.pdf is the fill-able pdf form. Both the form.pdf and the PHP script file from which I have given the above lines of code are in the same folder. I have checked that PDFtk is executing correctly through PHP by echoing shell_exec('pdftk') and it was returning the standard help details.
Just to provide more details, the path to pdftk is /usr/bin/ and PHP script and PDF form files are located under /var/www/html/pdfmerge.
Can some one please guide what I am doing wrong that the command execution through PHP is failing with error code 11?
I have configured PDFTk package on CentOS linux distribution and I am able to execute the pdftk from the command prompt and it merges the FDF form with the PDF and successfully generates the flattened(Filled) PDF. I am using following command to test the Pdftk using shell.
Code: Select all
pdftk /tmp/form.pdf fill_form /tmp/fdfbm0pe7 output /tmp/filledform.pdf flattenCode: Select all
$command = 'pdftk form.pdf fill_form '. $fdf_fn. ' output - flatten';
passthru($command, $error);
The $fdf_fn above has the FDF file name. The form.pdf is the fill-able pdf form. Both the form.pdf and the PHP script file from which I have given the above lines of code are in the same folder. I have checked that PDFtk is executing correctly through PHP by echoing shell_exec('pdftk') and it was returning the standard help details.
Just to provide more details, the path to pdftk is /usr/bin/ and PHP script and PDF form files are located under /var/www/html/pdfmerge.
Can some one please guide what I am doing wrong that the command execution through PHP is failing with error code 11?