pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r1813071 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
Date Mon, 23 Oct 2017 19:56:21 GMT
Author: lehmi
Date: Mon Oct 23 19:56:20 2017
New Revision: 1813071

URL: http://svn.apache.org/viewvc?rev=1813071&view=rev
Log:
PDFOX-3977: search for root/info entries if the trailer values can't be resolved

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java?rev=1813071&r1=1813070&r2=1813071&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/COSParser.java Mon
Oct 23 19:56:20 2017
@@ -2043,6 +2043,8 @@ public class COSParser extends BaseParse
             trailer = xrefTrailerResolver.getTrailer();
             getDocument().setTrailer(trailer);
             List<COSObjectKey[]> trailerObjects = bfSearchForTrailer();
+            boolean rootFound = false;
+            boolean infoFound = false;
             if (trailerObjects.size() == 1)
             {
                 COSObjectKey[] trailerObj = trailerObjects.get(0);
@@ -2056,6 +2058,7 @@ public class COSParser extends BaseParse
                     if (rootDict != null && isCatalog(rootDict))
                     {
                         trailer.setItem(COSName.ROOT, document.getObjectFromPool(rootKey));
+                        rootFound = true;
                     }
                 }
                 if (infoKey != null && infoOffset != null)
@@ -2064,10 +2067,11 @@ public class COSParser extends BaseParse
                     if (infoDict != null && isInfo(infoDict))
                     {
                         trailer.setItem(COSName.INFO, document.getObjectFromPool(infoKey));
+                        infoFound = true;
                     }
                 }
             }
-            else
+            if (!rootFound || !infoFound)
             {
                 // search for the different parts of the trailer dictionary
                 for (Entry<COSObjectKey, Long> entry : bfSearchCOSObjectKeyOffsets.entrySet())



Mime
View raw message