Forms
- Source:
Methods
(static) addElectronicSignatureFormField(configuration) → {Promise.<boolean>}
Adds an electronic signature field to the document at the specified location.
Parameters:
| Name | Type | Description |
|---|---|---|
configuration |
ElectronicSignatureFieldConfiguration | The configuration for the electronic signature field. |
- Source:
Returns:
A promise containing the result of the operation.
true if the field was added successfully, false otherwise.
- Type
- Promise.<boolean>
Example
const result = await this.pdfRef.current?.getDocument().forms.addElectronicSignatureFormField({
pageIndex: 0,
bbox: { left: 100, top: 100, right: 300, bottom: 150 },
fullyQualifiedName: 'Signature1'
});
(static) addTextFormField(configuration) → {Promise.<boolean>}
Adds a text form field to the document at the specified location.
Parameters:
| Name | Type | Description |
|---|---|---|
configuration |
TextFormFieldConfiguration | The configuration for the text form field. |
- Source:
Returns:
A promise containing the result of the operation.
true if the field was added successfully, false otherwise.
- Type
- Promise.<boolean>
Example
const result = await this.pdfRef.current?.getDocument().forms.addTextFormField({
pageIndex: 0,
bbox: { left: 100, top: 100, right: 300, bottom: 150 },
fullyQualifiedName: 'TextField1'
});
(static) getFormElements() → {Promise.<Array.<FormElement>>}
Gets all the form elements for the current document.
- Source:
Returns:
A promise containing an array of the
FormElement objects.
- Type
- Promise.<Array.<FormElement>>
Example
const result = await this.pdfRef.current?.getDocument().forms.getFormElements();
(static) updateButtonFormFieldValue(fullyQualifiedName, selected) → {Promise.<boolean>}
Updates a button form field value on the document. This is used for checkboxes and radio buttons.
Parameters:
| Name | Type | Description |
|---|---|---|
fullyQualifiedName |
string | The fully qualified name of the button form field to update. |
selected |
boolean | The new value of the button form field (true for selected, false for deselected). |
- Source:
Returns:
A promise containing the result of the operation.
- Type
- Promise.<boolean>
Example
const result = await this.pdfRef.current?.getDocument().forms.updateButtonFormFieldValue(name, true);
(static) updateChoiceFormFieldValue(fullyQualifiedName, selectedIndices) → {Promise.<boolean>}
Updates a choice form field value on the document. This is used for combo boxes and list boxes.
Parameters:
| Name | Type | Description |
|---|---|---|
fullyQualifiedName |
string | The fully qualified name of the choice form field to update. |
selectedIndices |
Array.<number> | string | An array containing the indices of the selected option(s) in the choice form field. Can also be a string if a custom value needs to be set. |
- Source:
Returns:
A promise containing the result of the operation.
- Type
- Promise.<boolean>
Example
const result = await this.pdfRef.current?.getDocument().forms.updateChoiceFormFieldValue(name, [2]);
(static) updateTextFormFieldValue(fullyQualifiedName, value) → {Promise.<boolean>}
Updates a text form field value on the document.
Parameters:
| Name | Type | Description |
|---|---|---|
fullyQualifiedName |
string | The fully qualified name of the text form field to update. |
value |
string | The new text value. |
- Source:
Returns:
A promise containing the result of the operation.
- Type
- Promise.<boolean>
Example
const result = await this.pdfRef.current?.getDocument().forms.updateTextFormFieldValue(name, 'New text');