PdfForm
12 Sep 20253 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
count number
Gets the fields count (Read only).
exportEmptyFields boolean
Gets a value indicating whether allow to export empty fields or not.
fieldAutoNaming boolean
Gets a value indicating whether the automatic field naming is enabled for form fields.
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