Slurpy
Slurpy copied to clipboard
pdftk does not like multiple character handles
Using pdftk 1.44, it seems to balk with two letter handles. A sample dump data fields command that fails.
/usr/bin/pdftk AA=my/pdf.pdf dump_data_fields output /tmp/out.txt
The documentation for pdftk indicates they should only be one letter:
"Input files can be associated with handles, where a handle is a single, upper-case letter"
Thank you for pointing that out, I'll try to fix this issue asap, however i'm quite busy right now so feel free to contribute!
The newer version of pdftk, 2+, allows multiple letter handles. Since most versions of pdftk installed with package managers will have older versions, perhaps the factory constructor should have an optional second parameter, version? Then the specifically affected methods can provide functionality for different versions.
// Create a new factory instance, give it your path to pdftk binary
// You can optionally add the pdftk version of your binary if you are not using the most recent version
$factory = new \Shuble\Slurpy\Factory('/path/to/pdftk', '1.44');
Thank you for this. You should add the option to the documentation as well. By the way, excellent wrapper!