I’m using pdftk to concatenate pdf files on the fly by making an exec() call like so:
exec("/path/to/pdftk /path/to/file1.pdf /path/to/file2.pdf cat output path/to/output.pdf", $execoutput);
This all works perfectly well in a linux environment, but when run locally on our development environments (a mix of Windows/Uniform Server and OSX/MAMP) this seems to silently fail. $execoutput is an empty array.
If the command that is sent to exec() is copy and pasted to the command line in either Windows or OSX it has the desired output and the concatenated file is generated. Each developer machine has pdftk installed and it can be demonstrated to be fully functional from the command line.
This currently has me stumped. I am at a loss to explain why this is happening.
I eventually figured out what was going on. Like a noob I had assumed every machine was running the latest version of pdftk. They weren’t.
It would appear that the problem described above relates to a known bug which was fixed in version 1.43
From http://www.pdflabs.com/docs/pdftk-version-history/
Guess which was the only setup to be running a version >= 1.43 😉
Updating each development environment to the latest version of pdftk (currently 1.44) has solved the problem