pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1758823 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
Date Thu, 01 Sep 2016 17:59:42 GMT
Author: tilman
Date: Thu Sep  1 17:59:42 2016
New Revision: 1758823

URL: http://svn.apache.org/viewvc?rev=1758823&view=rev
Log:
PDFBOX-3479: don't throw exception if no rectangle in widget

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java?rev=1758823&r1=1758822&r2=1758823&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
Thu Sep  1 17:59:42 2016
@@ -22,6 +22,8 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.contentstream.operator.Operator;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdfparser.PDFStreamParser;
@@ -47,6 +49,8 @@ import org.apache.pdfbox.util.Matrix;
  */
 class AppearanceGeneratorHelper
 {
+    private static final Log LOG = LogFactory.getLog(AppearanceGeneratorHelper.class);
+
     private static final Operator BMC = Operator.getOperator("BMC");
     private static final Operator EMC = Operator.getOperator("EMC");
  
@@ -126,14 +130,15 @@ class AppearanceGeneratorHelper
                 }
                 else
                 {
-                    appearanceStream = new PDAppearanceStream(field.getAcroForm().getDocument());
-                    
                     PDRectangle rect = widget.getRectangle();
                     if (rect == null)
                     {
-                        throw new IOException("widget of field " + field.getFullyQualifiedName()
+ " has no rectangle");
+                        LOG.warn("widget of field " + field.getFullyQualifiedName() + " has
no rectangle, no appearance stream created");
+                        continue;
                     }
                     
+                    appearanceStream = new PDAppearanceStream(field.getAcroForm().getDocument());
+                    
                     // Calculate the entries for the bounding box and the transformation
matrix
                     // settings for the appearance stream
                     int rotation = resolveRotation(widget);



Mime
View raw message