You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2014/09/17 21:37:48 UTC

svn commit: r1625778 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java

Author: tilman
Date: Wed Sep 17 19:37:47 2014
New Revision: 1625778

URL: http://svn.apache.org/r1625778
Log:
PDFBOX-2332: allow missing space characters after endstream in non sequential parser, e.g. "entstream8 0 obj"

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=1625778&r1=1625777&r2=1625778&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 Wed Sep 17 19:37:47 2014
@@ -1626,6 +1626,13 @@ public class NonSequentialPDFParser exte
                 // avoid follow-up warning about missing endobj
                 pdfSource.unread("endobj".getBytes("ISO-8859-1"));
             }
+            else if (endStream.length() > 9 && isLenient && endStream.substring(0,9).equals("endstream"))
+            {
+                LOG.warn("stream ends with '" + endStream + "' instead of 'endstream' at offset "
+                        + pdfSource.getOffset());
+                // unread the "extra" bytes
+                pdfSource.unread(endStream.substring(9).getBytes("ISO-8859-1"));
+            }
             else if (!endStream.equals("endstream"))
             {
                 throw new IOException(