pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1766217 - in /pdfbox/branches/2.0: pdfbox/src/main/java/org/apache/pdfbox/pdfparser/ preflight/src/main/java/org/apache/pdfbox/preflight/process/ preflight/src/test/resources/
Date Sat, 22 Oct 2016 17:09:14 GMT
Author: tilman
Date: Sat Oct 22 17:09:14 2016
New Revision: 1766217

URL: http://svn.apache.org/viewvc?rev=1766217&view=rev
Log:
PDFBOX-3540: linearized files have 2 trailers

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/XrefTrailerResolver.java
    pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/TrailerValidationProcess.java
    pdfbox/branches/2.0/preflight/src/test/resources/expected_errors.txt

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/XrefTrailerResolver.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/XrefTrailerResolver.java?rev=1766217&r1=1766216&r2=1766217&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/XrefTrailerResolver.java
(original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/XrefTrailerResolver.java
Sat Oct 22 17:09:14 2016
@@ -129,7 +129,17 @@ public class XrefTrailerResolver
         SortedSet<Long> sortedOffset = new TreeSet<Long>(offsets);
         return bytePosToXrefMap.get(sortedOffset.last()).trailer;
     }
-    
+
+    /**
+     * Returns the count of trailers.
+     *
+     * @return the count of trailers.
+     */
+    public final int getTrailerCount()
+    {
+        return bytePosToXrefMap.size();
+    }
+
     /**
      * Signals that a new XRef object (table or stream) starts.
      * @param startBytePos the offset to start at

Modified: pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/TrailerValidationProcess.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/TrailerValidationProcess.java?rev=1766217&r1=1766216&r2=1766217&view=diff
==============================================================================
--- pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/TrailerValidationProcess.java
(original)
+++ pdfbox/branches/2.0/preflight/src/main/java/org/apache/pdfbox/preflight/process/TrailerValidationProcess.java
Sat Oct 22 17:09:14 2016
@@ -63,7 +63,9 @@ public class TrailerValidationProcess ex
         PDDocument pdfDoc = ctx.getDocument();
 
         COSDictionary linearizedDict = getLinearizedDictionary(pdfDoc);
-        if (linearizedDict != null)
+        // linearized files have two trailers, everything else is not a linearized file
+        // so don't make the checks for linearized files
+        if (linearizedDict != null && ctx.getXrefTrailerResolver().getTrailerCount()
== 2)
         {
             // it is a linearized PDF, check the linearized dictionary
             checkLinearizedDictionnary(ctx, linearizedDict);

Modified: pdfbox/branches/2.0/preflight/src/test/resources/expected_errors.txt
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/preflight/src/test/resources/expected_errors.txt?rev=1766217&r1=1766216&r2=1766217&view=diff
==============================================================================
--- pdfbox/branches/2.0/preflight/src/test/resources/expected_errors.txt (original)
+++ pdfbox/branches/2.0/preflight/src/test/resources/expected_errors.txt Sat Oct 22 17:09:14
2016
@@ -332,7 +332,7 @@ terminanschreiben.pdf=7.1
 # Bavaria unclear
 
 PDFExportDialog2.pdf=
-Pardes13_Rez02.pdf=1.4.6
+Pardes13_Rez02.pdf=
 
 # <ptt:T_Real>IEEE754D,L,3A4901F387D31108</ptt:T_Real> because of <pdfaProperty:valueType>Real</pdfaProperty:valueType>
 good0016.pdf=7.1



Mime
View raw message