pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1465217 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java
Date Sat, 06 Apr 2013 10:05:30 GMT
Author: lehmi
Date: Sat Apr  6 10:05:30 2013
New Revision: 1465217

URL: http://svn.apache.org/r1465217
Log:
PDFBOX-1515: use LETTER as default pagesize if no mediabox is defined

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

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java?rev=1465217&r1=1465216&r2=1465217&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPage.java Sat Apr  6 10:05:30
2013
@@ -16,6 +16,8 @@
  */
 package org.apache.pdfbox.pdmodel;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.pdfbox.cos.COSArray;
 import org.apache.pdfbox.cos.COSBase;
 import org.apache.pdfbox.cos.COSDictionary;
@@ -62,6 +64,11 @@ import java.util.List;
 public class PDPage implements COSObjectable, Printable
 {
 
+    /**
+     * Log instance.
+     */
+    private static final Log LOG = LogFactory.getLog(PDPage.class);
+
     private static final int DEFAULT_USER_SPACE_UNIT_DPI = 72;
 
     private static final float MM_TO_UNITS = 1/(10*2.54f)*DEFAULT_USER_SPACE_UNIT_DPI;
@@ -311,6 +318,11 @@ public class PDPage implements COSObject
         {
             retval = getParent().findMediaBox();
         }
+        if (retval == null)
+        {
+            LOG.debug("Can't find MediaBox, using LETTER as default pagesize!");
+            retval = PDPage.PAGE_SIZE_LETTER;
+        }
         return retval;
     }
 



Mime
View raw message