Please provide a sample PDF that demonstrates the problem.
Leonard
On Dec 1, 2008, at 2:16 PM, mustafahalil yildiz wrote:
Hi,
I sign a pdf using the code below and then when I want to open it in
adobe reader 8 or previous versions it works fine and I can see the
signature but when I open it with adobe reader 9.0 I couldnt see the
signature what can be the problem ? can anyone help me?
byte[] pdfBits = baos.toByteArray();
SunPKCS11 akisProvider = new
SunPKCS11(Configuration.getHSMSettings());
Security.addProvider(akisProvider);
KeyStore ks = KeyStore.getInstance("PKCS11",
akisProvider);
ks.load(null, hsmPassword);
String alias = ks.aliases().nextElement();
key = (PrivateKey) ks.getKey(alias, hsmPassword);
chain = new java.security.cert.Certificate[1];
chain[0] = ks.getCertificate(alias);
reader = new PdfReader(new ByteArrayInputStream(pdfBits));
ByteArrayOutputStream fout = new ByteArrayOutputStream();
PdfStamper stp = PdfStamper.createSignature(reader,
fout, '\0');
PdfSignatureAppearance sap = stp.getSignatureAppearance();
sap
.setCertificationLevel
(PdfSignatureAppearance.CERTIFIED_NO_CHANGES_ALLOWED);
sap
.setRender(PdfSignatureAppearance.SignatureRenderNameAndDescription);
sap.setCrypto(key, chain,
null,PdfSignatureAppearance.WINCER_SIGNED);
sap.setReason("Bu belgenin içeriği doğrudur ve
tamdır.");
sap.setLocation("Ankara, TR");
Rectangle size = reader.getPageSize(1);
size.setLeft(size.getRight() - 220);
size.setRight(size.getRight() - 20);
size.setBottom(size.getTop() - 70);
size.setTop(size.getTop() - 20);
sap.setVisibleSignature(size, 1, null);
stp.close();
try {
FileOutputStream fos;
fos = new FileOutputStream(new File("C:/
imzali_dfg.pdf"));
fos.write(fout.toByteArray() );
fos.flush();
fos.close();
} catch ( Exception e) {
e.printStackTrace();
}
Halil
Access your email online and on the go with Windows Live Hotmail.
Sign up today.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win
great prizes
Grand prize is a trip for two to an Open Source event anywhere in
the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
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
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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