pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Chojecki <i...@rayman2200.de>
Subject Re: Visible signature using PDF Box - Content of SignatureOptions.visualSignature
Date Thu, 15 Aug 2013 10:46:59 GMT

Zitat von Kacer-EXTERNAL Jaroslav <Jaroslav.Kacer-EXTERNAL@gemalto.com>:

> Dear colleagues,

> I'm trying to create a visual signature in a PDF document using PDF  
> Box like this:
> PDDocument.addSignature(signature, signItfc, signatureOptions);
> Unfortunately I'm not sure what the content of  
> signatureOptions.visualSignature should be. I went through this  
> mailing list, the PDF Box Examples project, StackOverflow and I  
> googled a lot but unfortunately I was not able to find any piece of  
> example code or documentation on this. The only mention is in a post  
> in from 2011-11-03, saying one should be able to use iText to  
> generate it.

The visualSignature object / inputStream need to contain (I guess) an  
AppearanceDictionary with a visual representation. The problem is,  
that the needed helper for creating a table with text, image or both  
contents were missing in the pdfbox. So I used a fallback to iText and  
created the visual representation there and give pdfbox the file as  

So this undocumented feature was a hook and not a real solution for  
creating visual signatures. I've read that someone implemented helper  
for adding tables or some other elements to a page. Maybe this can be  
used for creating a visual representation, but I haven't evaluate this  

> I also tried to generate the content using  
> createPDocumentSignature() from the 2011-11-03 post but no luck, I'm  
> getting ClassCastException (although the structure built up in  
> createPDocumentSignature looks like what PDF Box wants, at the first  
> sight).

There should be a jar with runnable examples on the svn. Maybe you  
could look there for a signature creation example.

> Is there anyone who has succeeded generating the right content of  
> the input stream? Not necessarily using iText, in fact we are trying  
> to replace iText with PDF Box.

Good question, maybe someone can provide such implementation. So we  
can update and build a user friendly interface for this purpose.

> ...
> Are there any plans to update the SignatureOptions class to accept a  
> structured Java object instead of an InputStream? That would make  
> things a lot easier.
As far as there is a suitable solution. Maybe a first step would be to  
use something like PDAppearanceDictionary. But I haven't spend this  
year much time with the implementation, so I forgot how I solved the  
visualisation of the signature.

> Thank you very much!
>  Jarda

Best regards

View raw message