1

I am currently writing a script that fills a set of project data into given form-fields of template-PDFs and then saves those documents to a repository for further editing by project members (the documents have much more fields than those filled automatically).

The template-PDFs were previously created by me in Adobe InDesign and then saved with "Extended Features" in Adobe Acrobat Pro to make it editable in free Acrobat Reader and also pdfformfiller2.

This little java-wrapper for iText can fill PDF-Forms with utf8 text, which works pretty well with my script. The command I use is:

java -jar pdfformfiller.jar doc1_template.pdf -f text_input.txt doc1_filled.pdf

The problem is that after being filled with the data, pdfformfiller2 outputs a doc1_filled.pdf which is only editable in Adobe Acrobat Pro again. Because the script is intended to run automatically, I cannot save every single PDF with "Extended Features" again after they have been filled by the script. Is there any option or fix in the wrapper-code to fix this?

Btw. the option "-flatten" of pdfformfiller2 is disabled.

cruzel
  • 15
  • 4
  • pdfformfiller2 does not fill-in forms using an incremental update. Thus, it automatically breaks any signatures present in the PDF. A special type of signatures, usage rights signatures, are the mechanism used for granting "Extended Features". You might try recompiling pdfformfiller2 after replacing `new PdfStamper(reader, os, '\0')` by `new PdfStamper(reader, os, '\0', true)` which makes use of incremental updates. I've not tried, though, there may yet be other showstoppers in pdfformfiller2. – mkl Jul 24 '15 at 14:28
  • To extend mkl's comment, adding Extended Rights has to be the very last step before distributing a form. Now, there is another consideration: Would it be acceptable to require your users to use Reader XI or newer? (note, the Extended Rights (for saving) only have any purpose with Adobe Reader X and older). So, it is up to you (and your users) to determine whether you can actually do it without Extended Rights at all (and instead of that require Reader XI or newer). – Max Wyss Jul 24 '15 at 23:00
  • mkl's fix did the job! :) @Max Wyss: I tried it with the newest Adobe Reader DC and it wouldn't let me edit/save the files after they had been filled... – cruzel Jul 27 '15 at 06:16
  • @cruzel Great that the *fix did the job*. As I hadn't tested it, I merely posted the fix as comment, but as you confirmed that it works, I gladly made it an actual answer. – mkl Jul 27 '15 at 09:56

1 Answers1

0

pdfformfiller2 does not fill-in forms using an incremental update. Thus, it automatically breaks any signatures present in the PDF. (For backgrounds cf. this answer on information security.)

A special type of signatures, usage rights signatures, are the mechanism used for granting "Extended Features". Thus, as observed, pdfformfiller2 breaks "Extended Features".

You might try recompiling pdfformfiller2 after replacing

new PdfStamper(reader, os, '\0')

by

new PdfStamper(reader, os, '\0', true)

which makes use of incremental updates. (For backgrounds cf. this answer; in append mode the iText PdfStamper generates incremental updates. iText is the PDF library used by pdfformfiller2.)

Community
  • 1
  • 1
mkl
  • 90,588
  • 15
  • 125
  • 265