# Introduction to Basic Concepts of PDF Forms
This chapter will introduce the basic concepts of PDF forms and demonstrate how to use the APIs provided by Foxit PDF SDK for Web to perform basic form operations.
# Introduction to PDF Forms
PDF forms are a special type of PDF document that contain interactive fields where users can input text or select checkboxes. You can create PDF forms from any PDF, word processor, image file, or paper document.
In Foxit PDF SDK for Web, PDF forms are divided into three main objects based on their structural hierarchy: Form, Field, and Widget, which respectively represent forms, fields, and form widgets within a PDF document.
The class name for Form is
PDFForm
, and its instance can be obtained using the PDFDoc.getForm() (opens new window) method.The class name for Field is
PDFFormField
, and its instance can be obtained using the PDFForm.getField (opens new window) and PDFForm.getFieldAtPosition (opens new window) methods.The class name for Widget is
Widget
, and its instance can be obtained using the PDFFormField.getWidgetsCount (opens new window) and PDFFormField.getWidget (opens new window) methods. Note that Widget is a special type of annotation and can also be obtained through thePDFPage
method getAnnots (opens new window), but it requires filtering based on the annotation type.
It is important to emphasize that signature fields are a special type of field represented by a separate class, PDFSignature (opens new window). The PDFSignature
class inherits from PDFFormField (opens new window) and adds some signature-related interfaces.
The following diagram can be used to illustrate the relationships between these objects:
# Form Features Provided by Foxit PDF SDK for Web
You can use the APIs provided by Foxit PDF SDK for Web to perform the following form operations:
- Add or delete form fields
- Get or set form field properties
- Import or export form data
- Add and edit form actions
In addition, you can extend form functionality by adding Action, for example, using Action to perform the following tasks:
- Develop JavaScript scripts to implement custom actions for user events
- Automatically format, calculate, and validate form data
- Enable interaction with web services
These features provide developers with powerful tools for building complex and highly interactive PDF form applications, which are suitable for various scenarios such as online surveys, application forms, order sheets, and more.