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

Thomas Chojecki commented on PDFBOX-1822:
-----------------------------------------

[~vvolkgang]
thx for your effort to improve the pdfbox :-)

As I mentioned in PDFBOX-1837 your problem is the use of PDDocument.save(...) 
method. After signing a document, it isn't possible to manipulate (merge or 
resave) the document without breaking the signature. If you trigger the save 
method, the whole document will be wrote up from the scratch. This mean pdfbox 
parse the document and hold this document in his kind of structure. If you 
trigger save the created structure will be wrote to a new file. 

PDF documents are complex files. After reading and saving it, there is no 
guarantee that the saved document is still the same. Each library works 
different so each library would create a complete different output document 
after just reading and saving it again. You did not need to add additional 
informations to get a different result.

If you have a document that was incrementally updated, pdfbox will remove and 
merge this revisions to one. The result are weird errors when you verify a 
signature. If you work with signatures you shall not rewrite the document. Only 
incremental updates are allowed. Some libs can detect such cases and use 
automatically incremental updates. 

I would appreciate it, if we can discuss your signature problems at the mailing 
list :-)
https://pdfbox.apache.org/mailinglists.html

> Signature byte range is Invalid
> -------------------------------
>
>                 Key: PDFBOX-1822
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1822
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing, PDModel, PDModel.AcroForm, Signing
>    Affects Versions: 1.8.3, 1.8.4, 2.0.0
>            Reporter: vakhtang koroghlishvili
>         Attachments: araxis-merge - compare two document.jpg, 
> damaged-sig.jpg, unsigned-signed.pdf, unsigned.pdf
>
>
> On person send me a unsigned PDF document. He wanted to sign it. When I try 
> to sign it (using pad box), I have some problem.
> After signing adobe reader tells me "The signature byre range is invalid".  
> I will attach original and signed document.
> I think, it is PDF box parser error. another signature libraries sign 
> document very well. I'm searching the problem at the moment, in order to fix 
> it.



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

Reply via email to