pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1710438 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java
Date Sun, 25 Oct 2015 12:36:58 GMT
Author: lehmi
Date: Sun Oct 25 12:36:58 2015
New Revision: 1710438

URL: http://svn.apache.org/viewvc?rev=1710438&view=rev
Log:
PDFBOX-3060: add type value "Catalog" to root dictionary if missing

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java?rev=1710438&r1=1710437&r2=1710438&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java (original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/PDFParser.java Sun Oct 25
12:36:58 2015
@@ -195,8 +195,12 @@ public class PDFParser extends COSParser
         // prepare decryption if necessary
         prepareDecryption();
     
-        parseTrailerValuesDynamically(trailer);
-    
+        COSDictionary root = (COSDictionary)parseTrailerValuesDynamically(trailer);
+        // in some pdfs the type value "Catalog" is missing in the root object
+        if (isLenient() && !root.containsKey(COSName.TYPE))
+        {
+            root.setItem(COSName.TYPE, COSName.CATALOG);
+        }
         COSObject catalogObj = document.getCatalog();
         if (catalogObj != null && catalogObj.getObject() instanceof COSDictionary)
         {



Mime
View raw message