Represents a collection of form fields in a PDF document. Provides access to the top-level form fields in the document’s AcroForm.

from nutrient import PdfFormFieldCollection

Methods

add_check_box_field

def add_check_box_field(self, name: str, page: PdfPage, x: float, y: float, width: float, height: float) -> PdfCheckBoxField

Adds a new check box field to the document on the specified page.

Parameters:

NameTypeDescription
namestrThe name of the check box field. Must be unique within the document.
pagePdfPageThe page where the check box field will be placed.
xfloatThe x coordinate of the field’s origin in points.
yfloatThe y coordinate of the field’s origin in points.
widthfloatThe width of the field in points.
heightfloatThe height of the field in points.

Returns: PdfCheckBoxField - The newly created . Raises:

  • InvalidStateException: Thrown when no document is loaded.
  • SdkException: Thrown when the field creation fails.

add_combo_box_field

def add_combo_box_field(self, name: str, page: PdfPage, x: float, y: float, width: float, height: float) -> PdfComboBoxField

Adds a new combo box (drop-down list) field to the document on the specified page.

Parameters:

NameTypeDescription
namestrThe name of the combo box field. Must be unique within the document.
pagePdfPageThe page where the combo box field will be placed.
xfloatThe x coordinate of the field’s origin in points.
yfloatThe y coordinate of the field’s origin in points.
widthfloatThe width of the field in points.
heightfloatThe height of the field in points.

Returns: PdfComboBoxField - The newly created . Raises:

  • InvalidStateException: Thrown when no document is loaded.
  • SdkException: Thrown when the field creation fails.

add_list_box_field

def add_list_box_field(self, name: str, page: PdfPage, x: float, y: float, width: float, height: float) -> PdfListBoxField

Adds a new list box field to the document on the specified page.

Parameters:

NameTypeDescription
namestrThe name of the list box field. Must be unique within the document.
pagePdfPageThe page where the list box field will be placed.
xfloatThe x coordinate of the field’s origin in points.
yfloatThe y coordinate of the field’s origin in points.
widthfloatThe width of the field in points.
heightfloatThe height of the field in points.

Returns: PdfListBoxField - The newly created . Raises:

  • InvalidStateException: Thrown when no document is loaded.
  • SdkException: Thrown when the field creation fails.

add_push_button_field

def add_push_button_field(self, name: str, page: PdfPage, x: float, y: float, width: float, height: float) -> PdfPushButtonField

Adds a new push button field to the document on the specified page.

Parameters:

NameTypeDescription
namestrThe name of the push button field. Must be unique within the document.
pagePdfPageThe page where the push button field will be placed.
xfloatThe x coordinate of the field’s origin in points.
yfloatThe y coordinate of the field’s origin in points.
widthfloatThe width of the field in points.
heightfloatThe height of the field in points.

Returns: PdfPushButtonField - The newly created . Raises:

  • InvalidStateException: Thrown when no document is loaded.
  • SdkException: Thrown when the field creation fails.

add_radio_button_field

def add_radio_button_field(self, group_name: str, option_name: str, page: PdfPage, x: float, y: float, width: float, height: float) -> PdfRadioButtonField

Adds a new radio button to an existing or new radio button group on the specified page.

Parameters:

NameTypeDescription
group_namestrThe name of the radio button group. All radio buttons with the same group name are mutually exclusive.
option_namestrThe unique option name for this radio button within the group.
pagePdfPageThe page where the radio button will be placed.
xfloatThe x coordinate of the field’s origin in points.
yfloatThe y coordinate of the field’s origin in points.
widthfloatThe width of the field in points.
heightfloatThe height of the field in points.

Returns: PdfRadioButtonField - The representing the radio button group. Raises:

  • InvalidStateException: Thrown when no document is loaded.
  • SdkException: Thrown when the field creation fails.

add_signature_field

def add_signature_field(self, name: str, page: PdfPage, x: float, y: float, width: float, height: float) -> PdfSignatureField

Adds a new signature field to the document on the specified page.

Parameters:

NameTypeDescription
namestrThe name of the signature field. Must be unique within the document.
pagePdfPageThe page where the signature field will be placed.
xfloatThe x coordinate of the field’s origin in points.
yfloatThe y coordinate of the field’s origin in points.
widthfloatThe width of the field in points.
heightfloatThe height of the field in points.

Returns: PdfSignatureField - The newly created . Raises:

  • InvalidStateException: Thrown when no document is loaded.
  • SdkException: Thrown when the field creation fails.

add_text_field

def add_text_field(self, name: str, page: PdfPage, x: float, y: float, width: float, height: float) -> PdfTextField

Adds a new text field to the document on the specified page.

Parameters:

NameTypeDescription
namestrThe name of the text field. Must be unique within the document.
pagePdfPageThe page where the text field will be placed.
xfloatThe x coordinate of the field’s origin in points.
yfloatThe y coordinate of the field’s origin in points.
widthfloatThe width of the field in points.
heightfloatThe height of the field in points.

Returns: PdfTextField - The newly created . Raises:

  • InvalidStateException: Thrown when no document is loaded.
  • SdkException: Thrown when the field creation fails.

clear

def clear(self) -> None

Removes all form fields from the document.

Raises:

  • InvalidStateException: Thrown when no document is loaded.
  • SdkException: Thrown when the operation fails.

find_by_full_name

def find_by_full_name(self, full_name: str) -> PdfFormField

Finds a form field by its full name (dot-separated path).

Parameters:

NameTypeDescription
full_namestrThe fully qualified name of the field.

Returns: PdfFormField - The if found, null otherwise.


get_item

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

Returns the element at the specified index.

Parameters:

NameTypeDescription
indexintThe zero-based index of the element to get.

Returns: PdfFormField - The element at the specified index.


remove_at

def remove_at(self, index: int) -> None

Removes the form field at the specified index. This also removes any child fields and associated widget annotations.

Parameters:

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

Raises:

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

Properties

count

@property
def count(self) -> int

Gets the number of top-level form fields in the document.

Type: int

Read-only property.


enumerator

@property
def enumerator(self) -> IEnumerator`1

Returns an enumerator that iterates through the form fields collection.

Type: IEnumerator1`

Read-only property.