pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1818975 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/LayerUtility.java
Date Thu, 21 Dec 2017 19:56:38 GMT
Author: tilman
Date: Thu Dec 21 19:56:38 2017
New Revision: 1818975

URL: http://svn.apache.org/viewvc?rev=1818975&view=rev
Log:
PDFBOX-4044: warn if negative cropbox origin

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/LayerUtility.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/LayerUtility.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/LayerUtility.java?rev=1818975&r1=1818974&r2=1818975&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/LayerUtility.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/multipdf/LayerUtility.java Thu Dec
21 19:56:38 2017
@@ -22,6 +22,8 @@ import java.io.OutputStream;
 import java.util.Arrays;
 import java.util.Map;
 import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import org.apache.fontbox.util.BoundingBox;
 import org.apache.pdfbox.cos.COSArray;
@@ -49,6 +51,8 @@ import org.apache.pdfbox.util.Matrix;
  */
 public class LayerUtility
 {
+    private static final Log LOG = LogFactory.getLog(LayerUtility.class);
+
     private static final boolean DEBUG = true;
 
     private final PDDocument targetDoc;
@@ -254,6 +258,14 @@ public class LayerUtility
             throw new IllegalArgumentException("Optional group (layer) already exists: "
+ layerName);
         }
 
+        PDRectangle cropBox = targetPage.getCropBox();
+        if ((cropBox.getLowerLeftX() < 0 || cropBox.getLowerLeftY() < 0) &&
transform.isIdentity())
+        {
+            // PDFBOX-4044 
+            LOG.warn("Negative cropBox " + cropBox + 
+                     " and identity transform may make your form invisible");
+        }
+
         PDOptionalContentGroup layer = new PDOptionalContentGroup(layerName);
         ocprops.addGroup(layer);
 



Mime
View raw message