Hello all.
I've written a java-method signing pdf-documents (which are created
by the tool scribus) using itext. With standard pdf documents
no problems... But if the scribus pdf contains only one form,
something went wrong. The resulting signed pdf doesn't show the
signature although it is in the "pdf-code" (Opened with word-pad ;-) )
Even using the setFormFlattening(true) does not help...
Surprisingly the PDF-Analyzer 2.5 preview-mode shows the digital
signature but all other tools don't.
Here's the code:
public static void signDocument(String zertifikat, String passphrase, String
inputFile, String outputFile, String reason, String location) {
try {
KeyStore ks = KeyStore.getInstance("pkcs12");
ks.load(new FileInputStream(zertifikat), passphrase.toCharArray());
String alias = (String)ks.aliases().nextElement();
PrivateKey key = (PrivateKey)ks.getKey(alias,
passphrase.toCharArray());
Certificate[] chain = ks.getCertificateChain(alias);
PdfReader reader = new PdfReader(inputFile);
FileOutputStream fout = new FileOutputStream(outputFile);
PdfStamper stp = PdfStamper.createSignature(reader, fout, '');
PdfSignatureAppearance sap = stp.getSignatureAppearance();
sap.setCrypto(key, chain, null,
PdfSignatureAppearance.WINCER_SIGNED);
sap.setReason(reason);
sap.setLocation(location);
sap.setVisibleSignature(new Rectangle(450,700,550,800), 1, null);
stp.close();
} catch (Exception e) {
System.out.println(e);
}
}
Scribus -> new empty page -> pdf -> signing -> signed pdf works fine
Scribus -> new empty page -> Insert form -> pdf -> signing -> signed pdf does
not work,
same configurations...
Any ideas?
Thank you very much!
Greetings from Ol' Germany,
Andreas
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions