|
View:
New views
1 Messages
—
Rating Filter:
Alert me
|
|
|
PdfStamper ignores pdfVersionHi,
I need to add a signature to an existing PDF document. I am using the PdfStamper to create the signature. So far this works. But I have problems with PDF version 1.2. I tried to set the PDF version in the PdfStamper as following: PdfStamper stp = PdfStamper.createSignature(reader, fout, PdfWriter.VERSION_1_4, new File( "/temp"), true); But the resulting PDF with the signature has always the same version than the original file (version 1.2 in my case). It ignores the version I specify in the method (PdfWriter.VERSION_1_4). Full code: KeyStore ks = KeyStore.getInstance("pkcs12"); ks.load(new FileInputStream("src/test/resources/thawtetest.p12"), "12345678".toCharArray()); String alias = (String) ks.aliases().nextElement(); PrivateKey key = (PrivateKey) ks.getKey(alias, "12345678".toCharArray()); Certificate[] chain = ks.getCertificateChain(alias); PdfReader reader = new PdfReader("src/test/resources/input12.pdf"); FileOutputStream fout = new FileOutputStream("test.pdf"); PdfStamper stp = PdfStamper.createSignature(reader, fout, PdfWriter.VERSION_1_4, new File( "/temp"), true); PdfSignatureAppearance sap = stp.getSignatureAppearance(); sap.setCrypto(key, chain, null, PdfSignatureAppearance.WINCER_SIGNED); sap.setReason("I'm the author"); sap.setLocation("Lisbon"); sap.setAcro6Layers(true); // comment next line to have an invisible signature sap.setVisibleSignature(new Rectangle(100, 100, 200, 200), 1, null); stp.close(); Can anyone give me a hint how to set the PDF version of the output PDF? Kind regards, Rafael ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ iText-questions mailing list iText-questions@... 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/ |
| Free embeddable forum powered by Nabble | Forum Help |