pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1723927 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/ImportFDF.java
Date Sun, 10 Jan 2016 13:55:25 GMT
Author: tilman
Date: Sun Jan 10 13:55:25 2016
New Revision: 1723927

URL: http://svn.apache.org/viewvc?rev=1723927&view=rev
Log:
PDFBOX-962: avoid NPE; setNeedAppearances

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/ImportFDF.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/ImportFDF.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/ImportFDF.java?rev=1723927&r1=1723926&r2=1723927&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/ImportFDF.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/ImportFDF.java Sun Jan 10 13:55:25
2016
@@ -18,6 +18,9 @@ package org.apache.pdfbox;
 
 import java.io.IOException;
 
+import org.apache.pdfbox.cos.COSDictionary;
+import org.apache.pdfbox.cos.COSName;
+
 import org.apache.pdfbox.pdmodel.PDDocument;
 import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
 
@@ -54,8 +57,15 @@ public class ImportFDF
     {
         PDDocumentCatalog docCatalog = pdfDocument.getDocumentCatalog();
         PDAcroForm acroForm = docCatalog.getAcroForm();
-        acroForm.setCacheFields( true );
+        if (acroForm == null)
+        {
+            return;
+        }
+        acroForm.setCacheFields(true);
         acroForm.importFDF( fdfDocument );
+        
+        //TODO this can be removed when we create appearance streams
+        ((COSDictionary) acroForm.getCOSObject()).setBoolean(COSName.getPDFName("NeedAppearances"),
true);
     }
 
     /**



Mime
View raw message