troubleshooting Question

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

Avatar of chennipher
chennipher asked on
Adobe AcrobatProgrammingScripting Languages
11 Comments1 Solution3640 ViewsLast Modified:

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 24.61.106.202] 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?

Thanks,
Jennifer
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' );
ASKER CERTIFIED SOLUTION
chennipher

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros