Am 03.11.2011 18:33, schrieb Wilfling Stefan:
Hi!
Hi Stefan,
I´m new to pdfbox and I´m trying to add a visible Signature.
An invisible digital signature works fine, but to get an visible doesn´t work
(I only get an rectangle on Mouse-Over).
Is there any simple way to add an visible Signature with the Default-Appearance
(http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PPKAppearances.pdf)
to a pdf-document?
I use the following code-part to create my
..
PDRectangle rect = rects.get(pageNo);
PDDocument documentSig = createPDocumentSignature(rect);
ByteArrayOutputStream outSig = new ByteArrayOutputStream();
documentSig.save(outSig);
SignatureOptions options = new SignatureOptions();
options.setPage(pageNo);
options.setVisualSignature(new
ByteArrayInputStream(outSig.toByteArray()));
document.addSignature(pdsignature, signatureinterfaceimpl,
options);
The documentation for the visual signature could be better.
The InputStream for the visualization expect a prepaired pdf with a
bunch of dictionaries. The pdfbox extract all needed dictionaries and
add it to the document. So you can't just add image bytes or so.
I think you asking yourself why the visual signature impl. was done so
complicated.
My problem was, I haven't enough functionality inside the pdfbox for
creating a table with an image and informations like name, location or
reason. So I decide using iText ;-) for creating the visualisation and
adding this as InputStream to the pdfbox. Not the best way, but the only
fast solution.
Hope you understand what I meaning. If not, I can try to explain it in
german. :-)
If someone can implement something like tables in pdfbox, I can rewrite
the implementation and simplify it.
Best regards
Thomas