How can I help you?
PdfForm
6 Feb 20264 minutes to read
Represents a PDF form.
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Access the form of the PDF document
let form: PdfForm = document.form;
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();Properties
Get count number
Gets the fields count (Read only).
Get exportEmptyFields boolean
Gets a value indicating whether allow to export empty fields or not.
Set exportEmptyFields void
Sets a value indicating whether allow to export empty fields or not.
| Parameter | Type | Description |
|---|---|---|
| value | boolean |
Export empty fields. |
Get fieldAutoNaming boolean
Gets a value indicating whether the automatic field naming is enabled for form fields.
Set fieldAutoNaming void
Sets a value indicating whether field auto-naming is enabled for form fields.
| Parameter | Type | Description |
|---|---|---|
| value | boolean |
Enable or disable field auto naming. The default value is false. |
Get needAppearances boolean
Gets a value indicating whether need appearances (Read only).
Methods
add
Add a new PdfField.
| Parameter | Type | Description |
|---|---|---|
| field | PdfField |
Field object to add. |
Returns number
fieldAt
Gets the PdfField at the specified index.
| Parameter | Type | Description |
|---|---|---|
| index | number |
Field index. |
Returns PdfField
orderFormFields
Order the form fields.
Returns void
orderFormFields
Order the form fields based on page tab order.
| Parameter | Type | Description |
|---|---|---|
| tabOrder | PdfFormFieldsTabOrder |
tab order types for form fields. |
Returns void
orderFormFields
Order the form fields based on tab collection.
| Parameter | Type | Description |
|---|---|---|
| tabCollection | Map |
collection of tab order with page index. |
Returns void
removeField
Remove the specified PDF form field.
| Parameter | Type | Description |
|---|---|---|
| field | PdfField |
Field object to remove. |
Returns void
removeFieldAt
Remove the PDF form field from specified index.
| Parameter | Type | Description |
|---|---|---|
| index | number |
Field index to remove. |
Returns void
setDefaultAppearance
Sets the flag to indicate the new appearance creation
If true, appearance will not be created. Default appearance has been considered.
If false, new appearance stream has been created from field values and updated as normal appearance.
| Parameter | Type | Description |
|---|---|---|
| value | boolean |
Set default appearance. |
Returns void