PdfReader pdf = new PdfReader("in.pdf");
PdfStamper stp = new PdfStamper(pdf, new FileOutputStream("out.pdf"));
PdfFormField sig = PdfFormField.createSignature(stp.getWriter());
sig.setWidget(new Rectangle(100, 100, 200, 200), null);
sig.setFlags(PdfAnnotation.FLAGS_PRINT);
sig.put(PdfName.DA, new PdfString("/Helv 0 Tf 0 g"));
sig.setFieldName("Signature1");
sig.setPage(1);
stp.addAnnotation(sig, 1);
stp.close();
Paulo
----- Original Message -----
From: "Filipe Fedalto" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Friday, May 26, 2006 8:26 PM
Subject: [iText-questions] How to create an empty (non-signed) signature
field?
Hi all,
How can I create an empty (non-signed) signature field using PdfStamper? My
intention is to create a document with an empty signature field. The
document is not to be signed at this moment. The reason is that I want the
users to manually sign them later. So, I want that, when they open the
document in acrobat they see the empty field so they can click on it and
sign the document.
I tried to use:
PdfStamper stamper = PdfStamper.createSignature(documentoPDF, out, '\0');
// do something
sap.setVisibleSignature(new Rectangle(100, 300, 60, 60), 1, "empty
signature field");
stamper.close();
and
PdfStamper stamper = new PdfStamper(documentoPDF, out);
// do something
sap.setVisibleSignature(new Rectangle(100, 300, 60, 60), 1, "empty
signature field");
stamper.close();
But in both cases an exception is thrown, respectively:
java.lang.NullPointerException
at com.lowagie.text.pdf.PdfSignatureAppearance.getAppearance(
PdfSignatureAppearance.java:339)
at com.lowagie.text.pdf.PdfSignatureAppearance.preClose(
PdfSignatureAppearance.java:774)
at com.lowagie.text.pdf.PdfSignatureAppearance.preClose(
PdfSignatureAppearance.java:719)
at com.lowagie.text.pdf.PdfStamper.close(PdfStamper.java:200)
at br.com.ect.sadel.control.PreparacaoDocumentoControle.processarDocumento(
PreparacaoDocumentoControle.java:223)
and (in this case, the sap object is null)
java.lang.NullPointerException
at br.com.ect.sadel.control.PreparacaoDocumentoControle.processarDocumento(
PreparacaoDocumentoControle.java:209)
I'm sending an example PDF file attached (no virus), created in Acrobat
Standard 6.0, with an empty signature field. This is exactly what I want to
generate, but using iText, not Adobe Standard. First of all, what is this
"empty signature field"? Is this a form? What is it from iText point of
view?
Second, is it possible to somehow create such an empty (non-signed)
signature field with iText?
Thank you all in advance.
Filipe Fedalto
Cansado dos disparates e despautérios da República?
Quer um basta nas desventuras de nossos governantes?
Acesse http://www.monarquia.org.br e http://www.brasilimperial.org.br
e saiba mais a respeito.
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions