0

Recently I started work with pdftk, all good, but i can't access to all 'FieldType: Choice' (is like a dropdown or a html select tag), Options!, somebody could help me?

my code is:

 $pdf = new mikehaertl\pdftk\Pdf('./files/forms/uploads/imported.pdf');
 $results = $pdf->getDataFields();
echo '<pre>';
echo print_r($results);

enter image description here

then o can't find a solution to be able to access to the dropdown list options :

enter image description here

  • Could you post the output of `pdftk ./files/forms/uploads/imported.pdf dump_data_fields_utf8` ? This would make it clear whether the problem is on the pdftk side or on the php-pdftk side. – notautogenerated Sep 28 '21 at 15:31
  • Yes, look this, I attached the command line photo and the results, as you can look the FieldType: Button shows well the Opts, but the FieldType: Choice no... @notautogenerated – Eduardo Chiquito Sep 28 '21 at 16:14
  • It seems the issue lies with pdftk and not php-pdftk. Which version of pdftk are you using? By the way, you should probablly edit your question instead of posting an answer (and text is easier to work with than screenshots). – notautogenerated Sep 28 '21 at 16:28
  • what should I do?, uninstall and re-install pdftk by commandline? the pdftk version is 0.10.3 , I installed it via composer @notautogenerated – Eduardo Chiquito Sep 28 '21 at 17:22
  • php-pdftk version 0.10.3 is fine, no need to reinstall it. You can find your version of pdftk (as opposed to php-pdftk) with `pdftk --version`. If that reads 2.02 or lower, then I would suggest you to uninstall pdftk and replace it by its successor pdftk-java (from e.g. homebrew if you are on Mac, or your package manager if you are on Linux), which fixes a few bugs like yours. Full disclosure: I maintain pdftk-java. – notautogenerated Sep 28 '21 at 18:09
  • yes, you're rigth my pdftk version is 2.02... then how can install pdftk-java on Ubuntu server?, there are repos for that? or via apt? – Eduardo Chiquito Sep 28 '21 at 18:38
  • 1
    On Ubuntu 18.10 or newer, `apt install pdftk-java` will do. Otherwise download the package from https://launchpad.net/ubuntu/hirsute/+source/pdftk-java and install it manually with dpkg. – notautogenerated Sep 28 '21 at 19:11
  • Thank you so much!, I done!, now all working ok! :D @notautogenerated – Eduardo Chiquito Sep 28 '21 at 19:17

0 Answers0