Forms
A PDF document may contain any number of form fields that allow a user to enter information on a PDF page. An interactive form (sometimes referred to as an AcroForm) is a collection of fields for gathering information interactively from the user. Under the hood, PDF form fields are a type of PDF annotation called widget annotations.
ComPDFKit fully supports reading, filling, and editing PDF forms and provides utility methods to make working with forms simple and efficient.
Supported Form Fields
ComPDFKit supports all form types specified by the PDF specification (such as text boxes, checkboxes, radio buttons, drop-down lists, push buttons, and signatures).
CPDFWidget
is the base class for all form fields, and CPDFWidget
is a subclass for CPDFAnnotation
. A CPDFWidget
object by itself is not useful, only subclasses (CPDFCheckboxWidget
, CPDFRadiobuttonWidget
, CPDFAnnotationTextWidget
,CPDFPushbuttonWidget
,CPDFListboxWidget
,CPDFComboboxWidget
,CPDFTextWidget
,CPDFSignatureWidget
) are interesting. In parsing a PDF, however, any unknown or unsupported form fields will be represented as this base class.
We have to differentiate between field types and annotation objects:
Type | Annotation Object |
---|---|
Check Boxes | CPDFCheckboxWidget |
Radio Buttons | CPDFRadiobuttonWidget |
Push Buttons | CPDFPushbuttonWidget |
List Boxes | CPDFListboxWidget |
Combo Boxes | CPDFComboboxWidget |
Text | CPDFTextWidget |
Signatures |