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

Tilman Hausherr edited comment on PDFBOX-4393 at 12/5/18 12:03 PM:
-------------------------------------------------------------------

Add this code before calling addSignature:
{code:java}
PDResources res = acroForm.getDefaultResources();
acroForm.getCOSObject().setNeedToBeUpdated(true);
res.getCOSObject().setNeedToBeUpdated(true);
res.getCOSObject().getCOSDictionary(COSName.FONT).setNeedToBeUpdated(true);{code}
My new theory is that Adobe didn't like that it added two fonts (Helv and ZaDB) 
itself. So WE add them instead. However.... we do already add them when 
creating the AcroForm but didn't set the update mark it which is why my (now 
deleted) code no longer worked after I corrected the typo.


was (Author: tilman):
Add this code before calling addSignature:
{code:java}
PDResources res = acroForm.getDefaultResources();
acroForm.getCOSObject().setNeedToBeUpdated(true);
res.getCOSObject().setNeedToBeUpdated(true);
res.getCOSObject().getCOSDictionary(COSName.FONT).setNeedToBeUpdated(true);{code}
My new theory is that Adobe didn't like that it added these two fonts itself. 
So WE add them instead. However.... we do already add them when creating the 
AcroForm but didn't set the update mark it which is why my (now deleted) code 
no longer worked after I corrected the typo.

> PDF signature invalid after second interactive field signed
> -----------------------------------------------------------
>
>                 Key: PDFBOX-4393
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4393
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Signing
>    Affects Versions: 2.0.12
>         Environment: Windows
>            Reporter: Martin Klíma
>            Priority: Major
>         Attachments: image-2018-12-04-11-14-01-586.png, 
> image-2018-12-04-11-14-32-676.png, streamserve_test_sig0.pdf, 
> streamserve_test_sig0_saved.pdf, streamserve_test_sig0_saved_signed by 
> PDFBox.pdf, streamserve_test_sig0_saved_signed by PDFBox_then_signed by 
> AR.pdf, streamserve_test_sig0_signed by PDFBoxNEW.pdf, 
> streamserve_test_sig0_signed by PDFBoxNEW_signed by AR.pdf, 
> streamserve_test_sig2.pdf, streamserve_test_sig3.pdf, 
> streamserve_test_sig3.signed.pdf
>
>
> Hi guys,
> I stumped on the problem with PDFBox and interactive field signing. I have 
> PDF generated with OpenText StreamServe with two interactive fields for 
> signing. See example 1 (streamserve_test_sig0.pdf) in attachement.
> When I use Adobe Reader I can sign both of the visual fields just fine but 
> when I use PDFBox to sign one of this field the following signature is marked 
> as invalid. Doesn't matter if I use PDFbox or sign it manually with Adobe 
> Reader See example 3: 
>  *  streamserve_test_sig3.pdf (signed by PDFBox) - valid
>  *  streamserve_test_sig3.signed.pdf (signed 2nd by Adobe Reader) - invalid
> !image-2018-12-04-11-14-01-586.png|width=582,height=269!
>  
> Also last example - when it´s signed first by Adobe Reader and then with 
> PDFBox the signature seems valid but it says the document was "certified". 
> See example 2 (streamserve_test_sig2.pdf)
> !image-2018-12-04-11-14-32-676.png|width=591,height=283!
>  
> What could be wrong? When is signed whole document with PDFBox it works just 
> fine.
> Thanks for response,
> Martin
>  
>  
>  
>  
>  
>  
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to