The extended features of a pdf file, like filling out the fields or a dropdown field do not work, after adding a new page to a pdf document. The file is opened in append mode to preserve Reader enabling:
PdfDocument pdfDoc =
new PdfDocument(pdfReader, new PdfWriter(outputStream), new StampingProperties().useAppendMode());
Filling out the form fields does not break the signature, but after adding a new page to attach images to the file, the extended features are no longer available.
A new page is added with:
PdfPage page = pdfDoc.getPage(1);
pdfDoc.addNewPage(pdfDoc.getNumberOfPages() 1, new PageSize(page.getPageSize()));
Is it possible to add pages and attach images to the file without breaking the signature? The option removing the usage right is not applicable, since we want to be able to fill out and save the form.
CodePudding user response:
Adobe "Reader Enabling" works by adding a specific kind of signature, a usage rights signature, to the document. Such a usage rights signature has a set of UR transform parameters that define the additional rights granted to a Adobe Acrobat Reader user when opening the document in question, see ISO 32000-2, Table 258 — Entries in the UR transform parameters dictionary.
Adobe Reader apparently not only offers its users only the additional rights from those parameters, it also checks whether some other software applied other manipulations and rejects the document if it detects such changes. Or at least it checks whether any applied changes would have been allowed for PDFs with arbitrary approval signatures, see this answer.
This actually is very understandable. Otherwise one would only need to grab a single Reader Enabled PDF to create arbitrary Reader Enabled PDFs by simply adding an incremental update removing all existing content and adding the desired content. This of course is not what Adobe wants...