Thanks. That works. Ming 1T3XT info wrote: > > This is completely wrong: >> PdfAcroForm acroForm = stamp.getWriter().getAcroForm(); >> PdfFormField sigField = acroForm.addSignature("test", 300, >> 100, >> 400, 200); > > It causes: >> java.lang.RuntimeException: Unsupported in this context. Use >> PdfStamper.addAnnotation() >> at com.lowagie.text.pdf.PdfStamperImp.addAnnotation(Unknown Source) >> at com.lowagie.text.pdf.PdfAcroForm.addFormField(Unknown Source) >> at com.lowagie.text.pdf.PdfAcroForm.addSignature(Unknown Source) >> at >> com.lowagie.examples.general.copystamp.Register3.generatePDF(Register3.java:94) > > You need to add the signature like this: > PdfFormField sigField = PdfStamper.addSignature("test", pageNumber, 300, > 100, 400, 200); > > > sigField.setAdditionalActions(PdfName.V, > > PdfAction.javaScript("alert('success');", stamp.getWriter()) ); > >> Is this the right way to add javascript to PdfStamper? > > This is correct, the error occurred upon PdfAcroForm.addSignature(), > not here: PdfAction.javaScript("alert('success');", stamp.getWriter()); > -- > This answer is provided by 1T3XT BVBA > http://www.1t3xt.com/ - http://www.1t3xt.info > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, > CA > -OSBC tackles the biggest issue in open source: Open Sourcing the > Enterprise > -Strategies to boost innovation and cut costs with open source > participation > -Receive a $600 discount off the registration fee with the source code: > SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > > Buy the iText book: http://www.1t3xt.com/docs/book.php > >
-- View this message in context: http://www.nabble.com/JavaScript-action-after-a-signature-field-is-signed-tp22186145p22246088.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php