Slurpy icon indicating copy to clipboard operation
Slurpy copied to clipboard

pdftk does not like multiple character handles

Open wesnick opened this issue 11 years ago • 3 comments

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"

wesnick avatar Jun 19 '13 22:06 wesnick

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!

baikunz avatar Jun 20 '13 09:06 baikunz

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');

wesnick avatar Jun 22 '13 14:06 wesnick

Thank you for this. You should add the option to the documentation as well. By the way, excellent wrapper!

rredpoppy avatar Sep 03 '13 06:09 rredpoppy