pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1789167 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
Date Tue, 28 Mar 2017 15:43:51 GMT
Author: tilman
Date: Tue Mar 28 15:43:51 2017
New Revision: 1789167

URL: http://svn.apache.org/viewvc?rev=1789167&view=rev
Log:
PDFBOX-3738: remove /NeedAppearances when there are no previous fields because signature would
be invisible in Adobe Reader

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java?rev=1789167&r1=1789166&r2=1789167&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDDocument.java Tue Mar 28
15:43:51 2017
@@ -352,7 +352,21 @@ public class PDDocument implements Close
             prepareNonVisibleSignature(signatureField);
             return;
         }
-        
+
+        if (acroForm.getNeedAppearances())
+        {
+            // PDFBOX-3738 NeedAppearances true results in signature becoming invisible with
Adobe Reader
+            if (acroFormFields.size() == 1)
+            {
+                // we can safely delete it if there are no fields
+                acroForm.getCOSObject().removeItem(COSName.NEED_APPEARANCES);
+            }
+            else
+            {
+                LOG.warn("/NeedAppearances is set, signature may be ignored in Adobe Reader");
+            }
+        }
+
         prepareVisibleSignature(signatureField, acroForm, visualSignature);
 
         // Create Annotation / Field for signature



Mime
View raw message