On 5/5/2010 6:14 AM, itext-questions-requ...@lists.sourceforge.net wrote: Re: [iText-questions] add PdfAnnotation (form field) to a PdfTemplate 1T3XT info Tue, 04 May 2010 12:09:40 -0700
> Form fields with the same fully qualified name are considered > being the same field. So if you create a PdfFormField in a page > event and add it to every page in the onEndPage method, your > requirements are met, aren't they. So for the form with the same name in an end page event, I tried the following: public void onEndPage(PdfWriter writer, Document document) { TextField text = new TextField(writer, new Rectangle(200,500,400,600), "MyTextFieldName"); text.setText("Hello"); try { PdfFormField field = text.getTextField(); writer.addAnnotation(field); } catch (Exception e) { e.printStackTrace(); } } I get each of the annotations fully written into the PDF file (by text-editor inspection) but only the one on the first page displays in Acrobat Reader. So that's sad, but I can give the fields unique names easily enough, and then everything displays. With my follow up questions: the PDF spec suggests that instead of having other form fields in a form fields' kids array, you can have "pure" widget annotations, separating the annotation from the form field. It doesn't seem like iText supports that, but I'm not sure I'd gain much anyway. Thanks for your help here. michael ------------------------------------------------------------------------------ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/