[ 
https://issues.apache.org/jira/browse/PDFBOX-1811?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13849326#comment-13849326
 ] 

Tilman Hausherr edited comment on PDFBOX-1811 at 2/22/14 2:03 PM:
------------------------------------------------------------------


So my suggestion is to change in NonSequentialPDFParser.java the segment at

{code}
if (!endObjectKey.startsWith("endobj"))
{
      throw new IOException("Object (" + readObjNr + ":" + readObjGen + ") at 
offset "
                    + offsetOrObjstmObNr + " does not end with 'endobj'.");
}
{code}

to
{code}
 if (!endObjectKey.startsWith("endobj"))
 {
     if (endObjectKey.endsWith(" obj") && isLenient)
         LOG.warn("Object (" + readObjNr + ":" + readObjGen + ") at offset "
             + offsetOrObjstmObNr + " does not end with 'endobj' but with '" + 
endObjectKey + "'");
     else
         throw new IOException("Object (" + readObjNr + ":" + readObjGen + ") 
at offset "
             + offsetOrObjstmObNr + " does not end with 'endobj' but with '" + 
endObjectKey + "'"); }
{code}



was (Author: tilman):


So my suggestion is to change in NonSequentialPDFParser.java the segment at

{code}
if (!endObjectKey.startsWith("endobj"))
{
      throw new IOException("Object (" + readObjNr + ":" + readObjGen + ") at 
offset "
                    + offsetOrObjstmObNr + " does not end with 'endobj'.");
}
{code}

to
{code}
 if (!endObjectKey.startsWith("endobj"))
 {
     if (endObjectKey.endsWith(" obj"))
         LOG.warn("Object (" + readObjNr + ":" + readObjGen + ") at offset "
             + offsetOrObjstmObNr + " does not end with 'endobj' but with '" + 
endObjectKey + "'");
     else
         throw new IOException("Object (" + readObjNr + ":" + readObjGen + ") 
at offset "
             + offsetOrObjstmObNr + " does not end with 'endobj' but with '" + 
endObjectKey + "'"); }
{code}


> java.io.IOException: Object at offset does not end with 'endobj'
> ----------------------------------------------------------------
>
>                 Key: PDFBOX-1811
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1811
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing
>    Affects Versions: 2.0.0
>         Environment: XP, W7
>            Reporter: Tilman Hausherr
>            Assignee: Tilman Hausherr
>             Fix For: 1.8.5, 2.0.0
>
>
> I get this exception with the file amyuni2_05d__pdf1_3_acro4x.pdf (it was 
> once part of the project, now no more, but it can still be found on the web):
> java.io.IOException: Object (48:0) at offset 161333 does not end with 
> 'endobj'.
> This is true, the "endobject" is indeed missing in that file. However the 
> content of endObjectKey is 49 0 obj, i.e. the start of a new object.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to