PdfFormFieldCollection
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 PdfFormFieldCollectionMethods
add_check_box_field
def add_check_box_field(self, name: str, page: PdfPage, x: float, y: float, width: float, height: float) -> PdfCheckBoxFieldAdds a new check box field to the document on the specified page.
Parameters:
| Name | Type | Description |
|---|---|---|
name | str | The name of the check box field. Must be unique within the document. |
page | PdfPage | The page where the check box field will be placed. |
x | float | The x coordinate of the field’s origin in points. |
y | float | The y coordinate of the field’s origin in points. |
width | float | The width of the field in points. |
height | float | The 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) -> PdfComboBoxFieldAdds a new combo box (drop-down list) field to the document on the specified page.
Parameters:
| Name | Type | Description |
|---|---|---|
name | str | The name of the combo box field. Must be unique within the document. |
page | PdfPage | The page where the combo box field will be placed. |
x | float | The x coordinate of the field’s origin in points. |
y | float | The y coordinate of the field’s origin in points. |
width | float | The width of the field in points. |
height | float | The 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) -> PdfListBoxFieldAdds a new list box field to the document on the specified page.
Parameters:
| Name | Type | Description |
|---|---|---|
name | str | The name of the list box field. Must be unique within the document. |
page | PdfPage | The page where the list box field will be placed. |
x | float | The x coordinate of the field’s origin in points. |
y | float | The y coordinate of the field’s origin in points. |
width | float | The width of the field in points. |
height | float | The 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) -> PdfPushButtonFieldAdds a new push button field to the document on the specified page.
Parameters:
| Name | Type | Description |
|---|---|---|
name | str | The name of the push button field. Must be unique within the document. |
page | PdfPage | The page where the push button field will be placed. |
x | float | The x coordinate of the field’s origin in points. |
y | float | The y coordinate of the field’s origin in points. |
width | float | The width of the field in points. |
height | float | The 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) -> PdfRadioButtonFieldAdds a new radio button to an existing or new radio button group on the specified page.
Parameters:
| Name | Type | Description |
|---|---|---|
group_name | str | The name of the radio button group. All radio buttons with the same group name are mutually exclusive. |
option_name | str | The unique option name for this radio button within the group. |
page | PdfPage | The page where the radio button will be placed. |
x | float | The x coordinate of the field’s origin in points. |
y | float | The y coordinate of the field’s origin in points. |
width | float | The width of the field in points. |
height | float | The 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) -> PdfSignatureFieldAdds a new signature field to the document on the specified page.
Parameters:
| Name | Type | Description |
|---|---|---|
name | str | The name of the signature field. Must be unique within the document. |
page | PdfPage | The page where the signature field will be placed. |
x | float | The x coordinate of the field’s origin in points. |
y | float | The y coordinate of the field’s origin in points. |
width | float | The width of the field in points. |
height | float | The 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) -> PdfTextFieldAdds a new text field to the document on the specified page.
Parameters:
| Name | Type | Description |
|---|---|---|
name | str | The name of the text field. Must be unique within the document. |
page | PdfPage | The page where the text field will be placed. |
x | float | The x coordinate of the field’s origin in points. |
y | float | The y coordinate of the field’s origin in points. |
width | float | The width of the field in points. |
height | float | The 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) -> NoneRemoves 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) -> PdfFormFieldFinds a form field by its full name (dot-separated path).
Parameters:
| Name | Type | Description |
|---|---|---|
full_name | str | The fully qualified name of the field. |
Returns: PdfFormField - The if found, null otherwise.
get_item
def get_item(self, index: int) -> PdfFormFieldReturns the element at the specified index.
Parameters:
| Name | Type | Description |
|---|---|---|
index | int | The zero-based index of the element to get. |
Returns: PdfFormField - The element at the specified index.
remove_at
def remove_at(self, index: int) -> NoneRemoves the form field at the specified index. This also removes any child fields and associated widget annotations.
Parameters:
| Name | Type | Description |
|---|---|---|
index | int | The 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
@propertydef count(self) -> intGets the number of top-level form fields in the document.
Type: int
Read-only property.
enumerator
@propertydef enumerator(self) -> IEnumerator`1Returns an enumerator that iterates through the form fields collection.
Type: IEnumerator1`
Read-only property.