You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2015/10/25 13:40:45 UTC
svn commit: r1710439 -
/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
Author: lehmi
Date: Sun Oct 25 12:40:44 2015
New Revision: 1710439
URL: http://svn.apache.org/viewvc?rev=1710439&view=rev
Log:
PDFBOX-3060: add type value "Catalog" to root dictionary if missing
Modified:
pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java?rev=1710439&r1=1710438&r2=1710439&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java Sun Oct 25 12:40:44 2015
@@ -404,20 +404,28 @@ public class NonSequentialPDFParser exte
document.setDecrypted();
}
}
- else if(!parseMinimalCatalog)
+ else
{
- COSObject catalogObj = document.getCatalog();
- if (catalogObj != null)
+ COSDictionary rootDictionary = (COSDictionary)rootObject;
+ // in some pdfs the type value "Catalog" is missing in the root object
+ if (isLenient() && !rootDictionary.containsKey(COSName.TYPE))
{
- if (catalogObj.getObject() instanceof COSDictionary)
+ rootDictionary.setItem(COSName.TYPE, COSName.CATALOG);
+ }
+ if(!parseMinimalCatalog)
+ {
+ COSObject catalogObj = document.getCatalog();
+ if (catalogObj != null)
{
- parseDictObjects((COSDictionary) catalogObj.getObject(), (COSName[]) null);
- allPagesParsed = true;
- document.setDecrypted();
+ if (catalogObj.getObject() instanceof COSDictionary)
+ {
+ parseDictObjects((COSDictionary) catalogObj.getObject(), (COSName[]) null);
+ allPagesParsed = true;
+ document.setDecrypted();
+ }
}
}
}
-
// PDFBOX-1922: read the version again now that all objects have been resolved
readVersionInTrailer(trailer);