Growing (Rich) Text Fields in Adobe Interactive Forms
I was asked a lot about growing text fields and how to use rich text fields so I put together this blog. A growing text field adjusts its size according to the amount of the text provided by data or text that is entered into a text field. This means that the whole text is visible all the time. For the rest of this blog I will discuss things you need to know to use growing text fields and rich text fields when designing Adobe Interactive Forms (or print forms).
Using rich text
Two types of text are currently supported in Adobe forms: Plain text and rich text. Plain text is unformatted text. Rich text is formatted text that uses for example bold styling or italic styling. Rich text is based on XHTML.
When you want to display editable rich text you have to use a text field. The text field has three important properties in the object window to look at.
- Field tab – Field Format: Used to specify the format of a field (Rich text or plain text)
- Field tab – Allow Multiple Lines: Used to specify if a text field should show multiple lines
- Binding tab – Data Format: Sets the data format of the data a field is bound to (plain text or XHTML)
For the XML data you have to specify a name space for the HTML markup. It is important that the XHTML data fragment has exactly one outer element (the body tag in the sample). The contents of a data file could look like the following:
If you forgot how the data format should look like you can do the following. Format a caption in Designer (e.g. make it italics), make sure that the field is selected and then switch to the XML Source. Search for the
Editable text fields
In the value tab of the object window you can specify if the text field is read-only or editable. When a form with an editable rich text field is opened in the Reader plug-in, Reader or Acrobat, a window to format the rich text can be opened with ctrl-e. Please keep in mind that this is not a full-featured word processing application.
A growing text field
A growing text field is a text field whose size is adjusted accordingly to the amount of text contained in the data set or text that was entered. This means that the width or the height of a field can be automatically adjusted. Because the layout of the forms changes the template has to be rendered as a dynamic PDF form. During editing in the text field there is a scroll bar when the text can’t be displayed in the current field. After you have finished editing the field’s content, the layout of the whole form is adjusted to the amount of the entered text. Therefore it is important that you properly used flowed content for subforms in your form design.
To make the text field of the sample a growing text field you have to follow these steps:
- Make the content of page 1 flowed (select body page 1 and then go to the subform tab in the object window and set content to “Flowed”). Add a second field to the form to see how it is moved when the rich text field is resized.
- Select the text field and go to the layout window and check “Expand to fit” for the height.
- Your form has to be a dynamic PDF form to work. You can check this by opening the Form properties dialog and looking at the Defaults tab. XDP Preview Format should be “dynamic PDF”. If you have saved your template as a static PDF you can use “save as” to save it as a dynamic PDF. The “save as” dialog also shows you if it’s a static or a dynamic PDF.
- Go to the PDF Preview and enter text into the text field. During editing there is a scroll bar to the right of the text field. If not enter more text (use also the enter key). When you exit the text field, the layout of the PDF is adjusted so that all entered text is visible. In this case the height of the text field is increased to show all entered text.
- Try to add enough text that the text field spans more than one page.
If you encounter an issue with repeated text when printing a PDF that contains a text field spanning multiple pages then you should upgrade Reader to version 7.0.7.