I've no idea what you want the signature to look like but the best way is to
look at the PdfSignatureAppearance source for inspiration.

Paulo

----- Original Message ----- 
From: "Felipe Gaúcho" <[EMAIL PROTECTED]>
To: <itext-questions@lists.sourceforge.net>
Sent: Sunday, July 08, 2007 10:03 AM
Subject: [iText-questions] changing the signature image


> Hi there,
>
> finally I have the first certificates generated by footprint.dev.java.net
> Attached follows a demo certificate... a signed PDF document.. if
> should notice the right top corner small image with a link to the
> signature...
>
> the fragment of code I am using to sign the document is at the end of
> this email.
>
> I am trying several tricks but I couldn't change the aspect of that
> visible signature image.
>
> How to do it ?
>
> private void sign(InputStream input, File generatedPdf) throws
> IOException,
> FileNotFoundException, DocumentException, KeyStoreException,
> NoSuchAlgorithmException, UnrecoverableKeyException {
> PrivateKey pk = (PrivateKey) keystore.getKey(alias, pkPassword
> .toCharArray());
> Certificate[] chain = keystore.getCertificateChain(alias);
>
> FileOutputStream out = new FileOutputStream(generatedPdf);
> PdfStamper signerStamper = PdfStamper.createSignature(new PdfReader(
> input), out, '\0');
>
> PdfSignatureAppearance sap = signerStamper.getSignatureAppearance();
> sap.setCrypto(pk, chain, null, PdfSignatureAppearance.WINCER_SIGNED);
> sap.setReason(signatureReason);
> sap.setLocation(signatureLocation);
> sap.setContact(signatureMail);
> sap.setSignDate(Calendar.getInstance());
> // comment next line to have an invisible signature
> sap.setImage(Image.getInstance(getClass().getClassLoader().getResource("files/selo.gif")));
> sap.setVisibleSignature(new Rectangle(700, 350, 725, 374), 1,
> "cejugcert");
> sap.setSignatureGraphic(Image.getInstance(getClass().getClassLoader().getResource("files/selo.gif")));
> signerStamper.setThumbnail(Image.getInstance(getClass().getClassLoader().getResource("files/selo.gif")),
> 1);
> signerStamper.close();
> }


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
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