Hi!,
is any way to get it right?

When a sign pdf it will work like a charm - it is just a file with a damaged
Xref.
Same thing in Acrobat -
you get a "Do you want to save your changes?" dialog when you close the
viewer.

Here is the signed file:
http://old.nabble.com/file/p27798008/Test_signed_via_java.pdf
Test_signed_via_java.pdf 

Here is my source code:

                    KeyStore ks = KeyStore.getInstance("pkcs12");
                    ks.load(new
FileInputStream("C:\\SCANNER\\PokusHeslo.pfx"), "123456".toCharArray());
                    String alias = (String)ks.aliases().nextElement();
                    PrivateKey key = (PrivateKey)ks.getKey(alias,
"123456".toCharArray());
                    Certificate[] chain = ks.getCertificateChain(alias);
                    PdfReader reader = new PdfReader("c:\\Blank.pdf");
                    FileOutputStream fout = new
FileOutputStream("c:\\Test_signed_via_java.pdf");
                    PdfStamper stp = PdfStamper.createSignature(reader,
fout, '\0', null, true);
                    PdfSignatureAppearance sap =
stp.getSignatureAppearance();
                    sap.setCrypto(key, chain, null,
PdfSignatureAppearance.WINCER_SIGNED);
                    sap.setReason("I'm the author");
                    sap.setLocation("Lisbon");

                    sap.setVisibleSignature("SignatureField1[0]");
                    stp.close();
-- 
View this message in context: 
http://old.nabble.com/itext-making-broken-pdf---%21%21%21-damaged-Xref-%21%21%21-tp27798008p27798008.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to