Represents a form field in a PDF document. Form fields can be terminal (with widget annotations) or non-terminal (with child fields). This is the base class for all form field types. Use the specific subclasses (, , , etc.) for type-specific functionality.
from nutrient_sdk import PdfFormFieldConstruction
PdfFormField cannot be instantiated directly. Obtain instances through static factory methods or via other SDK classes.
Methods
get_child
def get_child(self, index: int) -> PdfFormFieldGets a child field by index.
Parameters:
| Name | Type | Description |
|---|---|---|
index | int | The 0-based index of the child field. |
Returns: PdfFormField - The child at the specified index. Raises:
IndexOutOfBoundsException: Thrown when index is out of range.
get_widget
def get_widget(self, index: int) -> PdfWidgetAnnotationGets a widget annotation by index.
Parameters:
| Name | Type | Description |
|---|---|---|
index | int | The 0-based index of the widget. |
Returns: PdfWidgetAnnotation - The at the specified index. Raises:
IndexOutOfBoundsException: Thrown when index is out of range.
remove_child_at
def remove_child_at(self, index: int) -> NoneRemoves a child field at the specified index. Also removes any grandchild fields and associated widget annotations.
Parameters:
| Name | Type | Description |
|---|---|---|
index | int | The 0-based index of the child field to remove. |
Raises:
IndexOutOfBoundsException: Thrown when index is out of range.SdkException: Thrown when the operation fails.
Properties
child_count
@propertydef child_count(self) -> intThe number of child fields.
Type: int
Read-only property.
default_value
@propertydef default_value(self) -> strThe default value of the field.
Type: str
Read-only property.
field_type
@propertydef field_type(self) -> PdfFormFieldTypeThe type of this form field.
Type: PdfFormFieldType
Read-only property.
full_name
@propertydef full_name(self) -> strThe fully qualified name of this field (dot-separated path from root).
Type: str
Read-only property.
is_read_only
@propertydef is_read_only(self) -> bool
@is_read_only.setterdef is_read_only(self, value: bool) -> NoneWhether the field is read-only.
Type: bool
is_required
@propertydef is_required(self) -> bool
@is_required.setterdef is_required(self, value: bool) -> NoneWhether the field is required.
Type: bool
is_terminal
@propertydef is_terminal(self) -> boolWhether this is a terminal field (has widget annotations instead of child fields). Terminal fields represent the actual interactive form elements.
Type: bool
Read-only property.
name
@propertydef name(self) -> strThe partial name of this field (T entry).
Type: str
Read-only property.
parent
@propertydef parent(self) -> PdfFormFieldThe parent field of this field, or null if this is a top-level field.
Type: PdfFormField
Read-only property.
value
@propertydef value(self) -> str
@value.setterdef value(self, value: str) -> NoneThe current value of the field.
Type: str
widget_count
@propertydef widget_count(self) -> intThe number of widget annotations.
Type: int
Read-only property.
Inheritors
PdfCheckBoxFieldPdfComboBoxFieldPdfListBoxFieldPdfPushButtonFieldPdfRadioButtonFieldPdfSignatureFieldPdfTextField