Avatar of chennipher

asked on 

pdftk shell script works fine when run from command line, but not when invoked by PHP

I'm running pdftk, a program that deals with PDFs, on a shared server running Linux. Among its operations, it can rotate a pdf 180 degrees and fill a pdf form with .fdf data.

I've installed pdftk and have been able to run operations from the command line without any problem. I'm merging .fdf ata with a pdf form I've created and outputting to a folder on the server. This works great when run from the command line.

However, when I invoke pdftk through a php file in the browser to merge the .fdf data with the pdf, using the exact same script, the process hangs and eventually produces a 0KB pdf file instead of the ~28KB pdf produced when run from the command line. I let the program run its course and the checked my site's error log. Here is the error this
attempt produced:

[Thu Mar 19 16:42:26 2009] [error] [client] sh: line 1:  8951 Killed  /home/sweetbel/bin/pdftk-1.41/pdftk/pdftk recipe_card_01.pdf fill_form test.fdf output /home/sweetbel/public_html/pdf/recipe_test.pdf, referer: http://sweetbellpaper.com/pdf/

Code from my php file, with full and correct paths:
passthru( '/home/sweetbel/bin/pdftk-1.41/pdftk/pdftk recipe_card_01.pdf fill_form test.fdf output /home/sweetbel/public_html/pdf/recipe_test.pdf' );

Here's the funny thing ... my php file invoking pdftk works just fine when I'm using the "rotate pdf 180 degrees" operation (/home/sweetbel/bin/pdftk-1.41/pdftk/pdftk recipe_card_01.pdf cat 1-endS output /home/sweetbel/public_html/pdf/recipe_test.pdf). So it seems the conflict is with the fill_form operation itself.

Does anyone have a clue as to why this is happening?

passthru( '/home/sweetbel/bin/pdftk-1.41/pdftk/pdftk recipe_card_01.pdf fill_form test.fdf output /home/sweetbel/public_html/pdf/recipe_test.pdf' );

Open in new window

Adobe AcrobatProgrammingScripting Languages

Avatar of undefined
Last Comment

8/22/2022 - Mon