Anja Kaiser <anja.kaiser <at> gmx.net> writes:
>
> Hi,
>
> is it possible to include an image in the visible signature of a PDF document
with iText. And if yes, how?
>
> Thanks for your help & best regards
>
> Anja
>
> -------------------------------------------------------
> All the advantages of Linux Managed Hosting--Without the Cost and Risk!
> Fully trained technicians. The highest number of Red Hat certifications in
> the hosting industry. Fanatical Support. Click to learn more
>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642>
Hi Anja
Yeah it is possible here is sample code:
import com.lowagie.text.*;
import com.lowagie.tools.*;
import com.lowagie.text.pdf.*;
public PdfStamper m_objPDFStamp = null;
public PdfSignatureAppearance m_objSigApp = null;
//Getting Image Instance
Image obj_pic = Image.getInstance("1.gif");
//Creating Signature
m_objPDFStamp = PdfStamper.createSignature(m_objPDFIn, m_objfos, '\0',
null, true);
//Getting Signature Appearance
m_objSigApp = m_objPDFStamp.getSignatureAppearance();
m_objSigApp.setCrypto(m_objPrk, m_objCertChain,null,
PdfSignatureAppearance.WINCER_SIGNED);
//Setting Signature Location
m_objSigApp.setVisibleSignature(new Rectangle(100, 500, 400, 400),
1, "Signature1");
m_objSigApp.setAcro6Layers(true);
PdfTemplate n1 = m_objSigApp.getLayer(1);
PdfTemplate n2 = m_objSigApp.getLayer(2);
n2.getBoundingBox().setBorder(4);
n2.getBoundingBox().setBorderColor(CMYKColor.DARK_GRAY);
n2.setLineDash(10);
n2.beginText();
BaseFont bf = BaseFont.createFont("Helvetica", BaseFont.WINANSI, false);
Font myFont = new Font(Font.HELVETICA, 200, Font.NORMAL);
bf = BaseFont.createFont("Helvetica", BaseFont.WINANSI, false);
n2.setColorStroke(java.awt.Color.BLUE);
n2.setFontAndSize(bf, 12);
//n2.setGrayFill(2);
//n2.setTextMatrix(10, 100);
n2.showText("Hello");
//Setting Signing Reason
n2.showText("I'm Auhtor of this document");
//Setting Contact Detail
n2.showText("Lahore, Pakistan");
n2.showText(m_straliases);
n2.endText();
obj_pic.setBorder(3);
obj_pic.setBorderColor(CMYKColor.BLUE);
obj_pic.setAbsolutePosition(10,10);
n2.addImage(obj_pic);
//Closing PdfStamper
m_objPDFStamp.close();
================================================================================
OR Other way is also there:
//Loading Signature Image from file
Image obj_pic = Image.getInstance("1.gif");
//Creating Signature
m_objPDFStamp = PdfStamper.createSignature(m_objPDFIn, m_objfos, '\0',
null, true);
//Getting Signature Appearance
m_objSigApp = m_objPDFStamp.getSignatureAppearance();
m_objSigApp.setCrypto(m_objPrk, m_objCertChain,null,
PdfSignatureAppearance.WINCER_SIGNED);
//Setting Signature Location
m_objSigApp.setVisibleSignature(new Rectangle(100, 500, 400, 400),
1, "Signature1");
//Setting Signing Reason
m_objSigApp.setReason("I'm Auhtor of this document");
//Setting Contact Detail
m_objSigApp.setContact("Lahore, Pakistan");
//Loading Signature Image in Signature Appearance
m_objSigApp.setImage(obj_pic);
//Setting Location
m_objSigApp.setLocation("Pakistan");
//Closing PdfStamper
m_objPDFStamp.close();
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642_______________________________________________
iText-questions mailing list
iText-questions@...
https://lists.sourceforge.net/lists/listinfo/itext-questions