pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Update Signature Contents
Date Mon, 02 May 2016 21:24:52 GMT
Hi,

Please download the source code, and search for the CreateSignature and 
CreateVisibleSignature examples. Don't try to reinvent this yourself, 
this is too tricky.

Tilman

Am 02.05.2016 um 23:16 schrieb Diego Azevedo:
> Hello all,
>
> I have a question regarding the update of a signature using PDFBox. I 
> want to create a dummy signature (/Contents <000...00>), and update it 
> latter with the real signature. Creating the dummy is easy, but I 
> tried to update the signature and it didn't work out. Here is my code:
>
>     byte[] signature = createRealSignature();
>     PDSignature sig = doc.getLastSignatureDictionary();
>     sig.setContents(signature);
>     sig.getCOSObject().setNeedToBeUpdated(true);
>     doc.saveIncremental(new FileOutputStream("signedPdf.pdf"))
>
> Does anyone know how to do it? Do I need to set other objects as 
> needed to be updated?
>
> Thanks in advance,
>
> -- 
> *_______________________________________________
>
> Diego Azevedo
> Developer
> E-SEC Digital Security
> www.esec.com.br <http://www.esec.com.br>
> 61 3323-4410*
>


Mime
View raw message