You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Adam Nichols (JIRA)" <ji...@apache.org> on 2011/06/27 19:28:47 UTC

[jira] [Commented] (PDFBOX-1051) Problem reading signed documents without new line after %%EOF

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

Adam Nichols commented on PDFBOX-1051:
--------------------------------------

Percent sign indicates the beginning of a comment (section 7.2.3 of the PDF spec), and also notes that "%PDF-n.m" and "%%EOF" are special exceptions to this rule.  Section 7.5.5 says "The last line of the file shall contain only the end-of-file marker, %%EOF."  Since is says "only", I'm going to say that "%%EOF1 obj <<......>>" is out of spec, so PDF libraries should not be expected to read them (although, that's great if they can).  My point here is that the problem isn't reading the file, it's writing it.

This patch looks fine, but I'm didn't look at the context nor did I test it.  I don't really have the time to look into this fully and commit it, but I just wanted to comment on where to look in the spec, and that I think this patch is likely the best way to resolve the issue (assuming line 1136 is the section which starts appending data to an existing PDF).

> Problem reading signed documents without new line after %%EOF
> -------------------------------------------------------------
>
>                 Key: PDFBOX-1051
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1051
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Writing
>    Affects Versions: 1.5.0
>            Reporter: Thomas Chojecki
>         Attachments: newLineAfterEOF.patch
>
>
> If a document without an new line after %%EOF was signed incremental, the first object in the revision will be wrote directly behind the %%EOF without a blank or a new line
> this will look like this:
> %%EOF1 obj <<......>>
> The adobe reader can read such documents, the pdfbox skip it. I looked inside the pdf specification and can't find more details about such kind of documents, so I think this is a valid document. In case that some readers can handle it, I added a "new line" before writing the incremental update with the PDDocument.saveIncremental method. 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira