webtom wrote:
> Hi,
> 
> i try to implement the following steps:
> 1) reading a signed pdf

OK, I assume you mean you read it with Adobe Reader.

> 2) adding a javascript code to the pdf and

Oops, you'll invalidate the signature!

> 3) printing the pdf to the default printer.

I assume you have some viewer such as Adobe Reader to do this.

> After executing the java code the signed document is printed but the
> signature is not valid.

Of course not! No tool can change a signed PDF without
invalidating the signature. That's the whole concept of
signatures.

> If i don't add the javascript code the pdf is
> displayed by acrobat reader within the browser but the signature is also
> invalid! (Error message: byte range of the signature is not valid.)

By reading, you don't mean opening it in Adobe Reader, but:

PdfReader reader = new PdfReader(pdfByteArray);
PdfStamper stamper = new PdfStamper(reader, outputStream);
stamper.close();

Your choice of words is misleading. You are reading the
PDF with PdfReader, but creating A NEW PDF with PdfStamper.
This NEW PDF is different from the original one (although
you may not realize it, some internal values are changed),
therefore it's only normal the signature is invalidated.

> My questions:
> 1) How is it possible to read a signed pdf document without destroying the
> signature?

Open it in Adobe Reader.

> 2) Is there a possibility to add javascript code so that the signature keeps
> valid?

Never! Not with iText, not with any other tool.

> Thanks for your hints

It was a very strange question.
br,
Bruno

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to