> > It seems as you are generating a PDF from scratch. > This PDF contains a form field that is to be rendered in a cell.
Yes, it is correct, I'm generating a PDF with a text field inside a cell from scratch, but the value set for the field (by using com.itextpdf.text.pdf.BaseField#setText(java.lang.String)) isn't displayed in the PDF without appearance regeneration as I mention at the end. Failing to regenerate appearances for the previous snippet would not > display the "Default value not shown if appearances are not regenerated", > because this widget appearance is bound to "new Rectangle(0,0)" inmediately > after the "text.getTextField()" call. This is straightforward to reproduce by modifying http://svn.code.sf.net/p/itext/code/examples/src/in_action/chapter17/FoobarLearningAgreement.java around line 218 to something like this: TextField letter = new TextField(writer, new Rectangle(0, 0), "letter"); letter.setText("Default value not shown if appearances are not regenerated"); // letter.setOptions(TextField.FILE_SELECTION); PdfFormField introduction = letter.getTextField(); // introduction // .setAdditionalActions( // PdfName.U, // PdfAction // .javaScript( // "this.getField('letter').browseForFileToSubmit();this.getField('receiving_institution').setFocus();", // writer)); cell.setCellEvent(new FieldPositioningEvents(writer, introduction)); table.addCell(cell); document.add(table); It is supposed that the default value "Default value not shown if appearances are not regenerated" should be displayed in the text field after just opening the PDF isn't it? In my case it is not displayed until the text field is focused. PS: I'm using Acrobat XI On Sat, Aug 16, 2014 at 8:03 AM, iText mailing list <i...@1t3xt.info> wrote: > On 8/16/2014 2:08 PM, Jaime Hablutzel Egoavil wrote: > > Failing to regenerate appearances for the previous snippet would not > > display the "Default value not shown if appearances are not > > regenerated", because this widget appearance is bound to "new > > Rectangle(0,0)" inmediately after the "text.getTextField()" call. > > I don't understand the question. > > It seems as you are generating a PDF from scratch. > This PDF contains a form field that is to be rendered in a cell. > So far, so good. > > But then you talk about regenerateField() which is a method that only > makes sense when working with an existing document. > Why would you need to regenerate a field when you create a document from > scratch? That doesn't make sense. > > > ------------------------------------------------------------------------------ > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > > iText(R) is a registered trademark of 1T3XT BVBA. > Many questions posted to this list can (and will) be answered with a > reference to the iText book: http://www.itextpdf.com/book/ > Please check the keywords list before you ask for examples: > http://itextpdf.com/themes/keywords.php > -- Jaime Hablutzel - RPC 994690880 *Tildes omitidas intencionalmente*
------------------------------------------------------------------------------
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php