Dear Paulo, I try to add the js code into "text 4" to get the sum value of the other 3 fileds.
I try to use the JS code by Adobe acrobat. But, it didn't work: String code = "AFSimple_Calculate(\"SUM\", new Array (\"Text 1\", \"Text 2\", \"Text 3\"));"; Please give me advise. Thanks yun Document document = new Document(PageSize.A4, 50, 50, 50, 50); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("text_fields.pdf")); document.open(); int yp; TextField app; PdfFormField field; yp = 700; app = new TextField(writer, new Rectangle(100, yp, 100 + 100, yp + 20), "Text 1"); field = app.getTextField(); writer.addAnnotation(field); yp = 650; app = new TextField(writer, new Rectangle(100, yp, 100 + 100, yp + 20), "Text 2"); field = app.getTextField(); writer.addAnnotation(field); yp = 600; app = new TextField(writer, new Rectangle(100, yp, 100 + 100, yp + 20), "Text 3"); field = app.getTextField(); writer.addAnnotation(field); yp = 550; app = new TextField(writer, new Rectangle(100, yp, 100 + 100, yp + 20), "Text 4"); field = app.getTextField(); String code = "AFSimple_Calculate(\"SUM\", new Array (\"Text 1\", \"Text 2\", \"Text 3\"));"; PdfAction ac = PdfAction.javaScript(code, writer); field.setAction(ac); writer.addAnnotation(field); document.close(); System.out.println("Finished."); ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions