Chapter 8. Filling out interactive forms

 

This chapter covers

  • Creating AcroForms using iText
  • Manipulating AcroForm fields
  • Manipulating XFA forms
  • Filling out Reader-enabled forms

Adobe products support two ways to create, view, and fill out interactive PDF forms. One is based on AcroForm technology. These forms are defined using PDF objects that correspond to subclasses of the PdfObject object in iText: PdfDictionary, PdfArray, and so on. We’ve already created a form like this with Open Office in chapter 6.

The other type of form uses the XML Forms Architecture (XFA). These are created with the Designer tool that ships with Acrobat. You’ll learn how to fill out an XFA form in the second part of this chapter. First, we’ll have a closer look at AcroForms.

8.1. Introducing AcroForms

You created form fields in the previous chapter. As you saw, you had to use the getAnnot() method in JavaScript to get an annotation object from a specific page. But you used getField() (without specifying a page) when the annotation corresponded to a form field. The best way to explain the relationship between a widget annotation and a form field is to quote the definition of a form field in ISO-32000-1:

8.2. Selecting states or trigger actions with button fields

8.3. Filling in data with text fields

8.4. Selecting options with choice fields

8.5. Refining the form-filling process

8.6. Introducing the XML Forms Architecture (XFA)

8.7. Preserving the usage rights of Reader-enabled forms

8.8. Summary