Works for me with this code:

PdfReader reader = new PdfReader("c:\\hello_field.pdf");
PdfStamper stp = PdfStamper.createSignature(reader, new 
FileOutputStream("c:\\hello_field_sig.pdf"), '\0');
AcroFields af = stp.getAcroFields();
af.setField("Text1", "BUM");
PdfSignatureAppearance sap = stp.getSignatureAppearance();
sap.setCrypto(key, chain, null, PdfSignatureAppearance.WINCER_SIGNED); 
// and so on

Paulo

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Felipe Gaúcho
> Sent: Thursday, June 14, 2007 9:40 AM
> To: [email protected]
> Subject: [iText-questions] signing PDF
> 
> Hi,
> 
> I am creating a new project:
> http://weblogs.java.net/blog/felipegaucho/archive/2007/06/intr
> oducing_the.html
> 
> it is already running some features, but the PDF details about digital
> signature and iText seems a bit odd for me.
> 
> in my basic use-case, the code:
> 
> 1 - read a PDF tamplate
> 
> 2 - fill form fields:
>      2.1 - connect to a JDBC data source
>      2.2 - read a mapping properties (mapping between the PDF fields
> and Column names)
>      2.3 - fill the fields using the values read from database and the
> mapping properties
> 
> 3 - sign the pdf
> 
> 4 - save the new PDF (with filled fields and signed)
> 
> ---------------------------
> 
> If I try to do that using that sample from the iText documentation,
> the generated PDF is never recognized as authentic signed PDF by Adobe
> because it say the content was changed since the pdf generation...
> 
> If I do that in two steps: first generating and saving a modified PDF,
> and then re-open this pdf, sign and save, everything works fine and
> Adobe don't disclaim anymore..
> 
> Why can't I do that in just 1 step ?
> 
> 
> best regards,
> 
>     Felipe Gaucho


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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