Adding an empty signature-field and signing 2007-12-02 - By Luca Tomat
Back Hello, I need to add two signature-fields and add a signature inside the first one.
This is how i do it:
...... ...... //Lets create the two fields PdfFormField sign1 = PdfFormField.createSignature( pdfStamper.getWriter()); sign1.setWidget(new Rectangle(100, 600, 180, 640), null); sign1.setFlags(PdfAnnotation.FLAGS_PRINT); sign1.setFieldName("sign1"); sign1.setPage(1); pdfStamper.addAnnotation(sign1, 1); PdfFormField sign2 = PdfFormField.createSignature( pdfStamper.getWriter()); sign2.setWidget(new Rectangle(200, 600, 280, 640), null); sign2.setFlags(PdfAnnotation.FLAGS_PRINT); sign2.setFieldName("sign2"); sign2.setPage(1); pdfStamper.addAnnotation(sign2, 1); ...... ...... //Creating the signature for the first field PdfSignatureAppearanceOSP signApp; signApp = pdfStamper.getSignatureAppearance(); signApp.setCrypto(null, certChain, null, PdfSignatureAppearance.WINCER_SIGNED); signApp.setReason("Author"); signApp.setCertified(2); signApp.setVisibleSignature("sign1"); ...... ......
Unfortunately on the last line (signApp.setVisibleSignature("sign1");) i get the error: The field sign1 does not exist.
Why? What am i doing wrong?
Thank you, Luca
Hello,<br>I need to add two signature-fields and add a signature inside the first one.<br><br>This is how i do it:<br><br>......<br>......<br> //Lets create the two fields<br>   ; PdfFormField sign1 = PdfFormField.createSignature (pdfStamper.getWriter());<br> sign1 .setWidget(new Rectangle(100, 600, 180, 640), null);<br>   ; sign1.setFlags(PdfAnnotation.FLAGS_PRINT); <br> sign1.setFieldName("sign1");<br> sign1.setPage (1);<br> pdfStamper.addAnnotation(sign1, 1 );<br> PdfFormField sign2 = PdfFormField .createSignature(pdfStamper.getWriter());<br> sign2.setWidget(new Rectangle(200, 600, 280, 640), null);<br> sign2.setFlags (PdfAnnotation.FLAGS_PRINT); <br> sign2 .setFieldName("sign2");<br> sign2 .setPage(1);<br> pdfStamper.addAnnotation (sign2, 1);<br>......<br> ......<br> //Creating the signature for the first field<br> PdfSignatureAppearanceOSP signApp;<br> signApp = pdfStamper.getSignatureAppearance();<br> signApp.setCrypto(null, certChain, null, PdfSignatureAppearance .WINCER_SIGNED);<br> signApp.setReason( "Author"); <br> signApp.setCertified(2);<br> signApp.setVisibleSignature("sign1 ");<br>......<br>
......<br><br>Unfortunately on the last line (signApp.setVisibleSignature(" ;sign1");) i get the error: The field sign1 does not exist.<br><br>Why? What am i doing wrong?<br><br>Thank you,<br> Luca<br>
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 __ ____ ____ ____ ____ ____ ____ ____ ____ ____ iText-questions mailing list iText-questions@(protected) https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
|
|