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 import PdfFormField

Methods

get_child

def get_child(self, index: int) -> PdfFormField

Gets a child field by index.

Parameters:

NameTypeDescription
indexintThe 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) -> PdfWidgetAnnotation

Gets a widget annotation by index.

Parameters:

NameTypeDescription
indexintThe 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) -> None

Removes a child field at the specified index. Also removes any grandchild fields and associated widget annotations.

Parameters:

NameTypeDescription
indexintThe 0-based index of the child field to remove.

Raises:

  • IndexOutOfBoundsException: Thrown when index is out of range.
  • SdkException: Thrown when the operation fails.

set_is_read_only

def set_is_read_only(self, value: bool) -> None

Sets whether the field is read-only.

Parameters:

NameTypeDescription
valueboolThe value to set for the IsReadOnly property.

set_is_required

def set_is_required(self, value: bool) -> None

Sets whether the field is required.

Parameters:

NameTypeDescription
valueboolThe value to set for the IsRequired property.

set_value

def set_value(self, value: str) -> None

Sets the current value of the field.

Parameters:

NameTypeDescription
valuestrThe value to set for the Value property.

Properties

child_count

@property
def child_count(self) -> int

Gets the number of child fields.

Type: int

Read-only property.


default_value

@property
def default_value(self) -> str

Gets the default value of the field.

Type: str

Read-only property.


field_type

@property
def field_type(self) -> PdfFormFieldType

Gets the type of this form field.

Type: PdfFormFieldType

Read-only property.


full_name

@property
def full_name(self) -> str

Gets the fully qualified name of this field (dot-separated path from root).

Type: str

Read-only property.


is_read_only

@property
def is_read_only(self) -> bool

Gets whether the field is read-only.

Type: bool

Read-only property.


is_required

@property
def is_required(self) -> bool

Gets whether the field is required.

Type: bool

Read-only property.


is_terminal

@property
def is_terminal(self) -> bool

Gets whether 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

@property
def name(self) -> str

Gets the partial name of this field (T entry).

Type: str

Read-only property.


parent

@property
def parent(self) -> PdfFormField

Gets the parent field of this field, or null if this is a top-level field.

Type: PdfFormField

Read-only property.


value

@property
def value(self) -> str

Gets the current value of the field.

Type: str

Read-only property.


widget_count

@property
def widget_count(self) -> int

Gets the number of widget annotations.

Type: int

Read-only property.