问题
In a business environment we have Adobe LiveCycle ES for several years. A key feature is to enable "Reader extensions" in PDFs, which unlocks some features in Adobe Reader for reader extended PDFs. One of them was allowing user to digitally sign empty signature fields in Adobe Reader.
I remember nothing happened when clicking on the signature field in Adobe Reader if the PDF was not "reader extended". This is the case e.g. if the PDF was generated using iText. This limitation is still confirmed in iText FAQ which is supposed to be up-to-date as the project is active.
I recently reexecuted some old code and surprisingly the empty signature field could be signed in Acrobat Reader DC.
The code generating the PDF is the following :
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(filename));
document.open();
document.add(new Paragraph("Hello World!"));
document.close();
The code for adding the signature field :
PdfReader pdf = new PdfReader(inputstream);
PdfStamper stp = new PdfStamper(pdf, new FileOutputStream(filename));
PdfFormField sig = PdfFormField.createSignature(stp.getWriter());
sig.setWidget(new Rectangle(100, 100, 200, 200), null);
sig.setFlags(PdfAnnotation.FLAGS_PRINT);
sig.put(PdfName.DA, new PdfString("/Helv 0 Tf 0 g"));
sig.setFieldName("Signature1");
sig.setPage(1);
stp.addAnnotation(sig, 1);
stp.close();
What changed ? I guess Adobe Acrobat DC has removed some reader extensions requirements, but I could not find any release note explaining this.
来源:https://stackoverflow.com/questions/40634083/reader-extensions-not-needed-anymore-for-digital-signature-in-acrobat-reader-dc