PdfSignatureAppearance.setImage() will do it for you. > -----Original Message----- > From: Lu, Steve (MTO) [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 11, 2006 11:53 PM > To: Paulo Soares > Subject: RE: [iText-questions] Setting Image in Signature Appearance > > Hi I have read your example on "Setting Image in Signature > Appearance". > But it doesn't work in mu code, do you have any idea? > Thanks in advance. > > ... > > KeyStore ks = > KeyStore.getInstance(KeyStore.getDefaultType()); > ks.load(new FileInputStream(ksFilePath), > password.toCharArray()); > String alias = > (String)ks.aliases().nextElement(); > PrivateKey key = (PrivateKey)ks.getKey(alias, > password.toCharArray()); > Certificate[] chain = > ks.getCertificateChain(alias); > > PdfReader in = new PdfReader(doc); > ByteArrayOutputStream out = new > ByteArrayOutputStream(); > PdfStamper stp = > PdfStamper.createSignature(in, out, > '\0'); > > PdfSignatureAppearance sap = > stp.getSignatureAppearance(); > sap.setCrypto(key, chain, null, > PdfSignatureAppearance.SELF_SIGNED); > sap.setReason("ServiceOntario e-Trans PDF > document"); > sap.setLocation("Downsview, ON"); > sap.setVisibleSignature(new > Rectangle(100, 100, 200, > 200), 1, null); > > PdfTemplate t1 = sap.getLayer(1); > PdfTemplate t2 = sap.getLayer(2); > Image img = Image.getInstance(imageFile); > img.scaleAbsoluteWidth(t2.getWidth()); > img.setAbsolutePosition(0, 0); > t2.addImage(img); > > stp.close(); > > return out.toByteArray(); > > > > ---- > RE: [iText-questions] Setting Image in Signature Appearance > Paulo Soares > Thu, 18 Nov 2004 06:40:36 -0800 > sap.setVisibleSignature(new Rectangle(100, 100, 300, 200), 1, null); > PdfTemplate n1 = sap.getLayer(1); //get rid of the question mark > PdfTemplate n2 = sap.getLayer(2); > Image img = Image.getInstance("c:\\my_image.gif"); > img.scaleAbsoluteWidth(n2.getWidth()); > img.setAbsolutePosition(0, 0); > n2.addImage(img); > >
------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_idv37&alloc_id865&op=click _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
