With Designer created forms you can only sign an existing empty field.

Paulo

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <itext-questions@lists.sourceforge.net>
Sent: Tuesday, August 28, 2007 1:05 PM
Subject: Re: [iText-questions] Question about Itext library and pdf 
signature


Thanks for your quick answer :)
How could I know the security settings?
Because I create all my different pdf in Adobe Designer without changing 
settings :(
So it's for that I don't understand the difference!!!

________________________________

De : [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] De la part de Paret, 
Thierry
Envoyé : mardi 28 août 2007 14:02
À : Post all your questions about iText here
Objet : Re: [iText-questions] Question about Itext library and pdf signature



Bonjour Michael,



Your different PDF files may have different security setting in which 
signing is not allowed.



Regards,

Thierry Paret



________________________________

From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of 
[EMAIL PROTECTED]
Sent: Tuesday, August 28, 2007 1:44 PM
To: itext-questions@lists.sourceforge.net
Subject: [iText-questions] Question about Itext library and pdf signature



Hi,



I use your library Itext in a project to sign pdf file.

I try to follow the code example that I saw on your website but I have a 
problem.



This is my java code :

try{

                  KeyStore ks = 
KeyStore.getInstance(KeyStore.getDefaultType());

                  ks.load(new FileInputStream("keystore.ks"), 
"pdfpassword".toCharArray());

                  PrivateKey key = (PrivateKey)ks.getKey("pdf", 
"pdfpassword".toCharArray());

                  Certificate[] chain = ks.getCertificateChain(alias);



                  for (int i = 0; i < pdfFilenames.length; i++) {



                        PdfReader reader = new PdfReader(pdfFilenames[i]);

                        //on enleve l'extension du nom de fichier à traiter 
afin de modifier le nom

                        String name = pdfFilenames[i].substring(0, 
pdfFilenames[i].lastIndexOf('.'));



                        FileOutputStream fout = new 
FileOutputStream(name+"_signed.pdf");



                        PdfStamper stp = PdfStamper.createSignature(reader, 
fout, '\0');

                        PdfSignatureAppearance sap = 
stp.getSignatureAppearance();

                        sap.setCrypto(key, chain, null, 
PdfSignatureAppearance.SELF_SIGNED);

                        
sap.setCertificationLevel(PdfSignatureAppearance.CERTIFIED_FORM_FILLING);

                        //comment next line to have an invisible signature

                        sap.setVisibleSignature(new Rectangle(100, 100, 200, 
200), 1, null);

                        stp.close();

                  }

            }catch(Exception e){

                  e.printStackTrace();

            }

There is no error during the execution.

But I don't see a difference between the first pdf and the pdf signed each 
time.

In fact, I make different tests.

I use 5 different pdf as input file. At the output only two pdf contain a 
signature (although the signature is different in these two cases).

So I don't understand why the signature doesn't work in every case.

If you can help me, it will be great.

Thanks



Best regards,



--

Michaël MARECHAL

DOD - ADSI - Pôle Elfe

*  01.42.97.78.06 / 2.78.06

* 14 - 2118


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to