How can I help you?
PdfFieldActions
16 Mar 20265 minutes to read
Represents actions to be performed as response to field events.
```typescript
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data);
// Access button field
let field: PdfButtonField = document.form.fieldAt(0) as PdfButtonField;
// Access the second page
let secondPage: PdfPage = document.getPage(2);
// Create a PdfDestination for the specified page
let destination: PdfDestination = new PdfDestination(secondPage)
// Create a new PdfGoToAction with the specified destination
let gotoAction: PdfGoToAction = new PdfGoToAction(destination);
// Get the pdf field actions
let fieldActions: PdfFieldActions = field.actions;
// Save the document
document.save(‘output.pdf’);
// Destroy the document
document.destroy();
Properties
Get format PdfJavaScriptAction
Gets the JavaScript action executed before the field value is formatted.
Set format void
Sets the JavaScript action executed before the field value is formatted.
| Parameter | Type | Description |
|---|---|---|
| value | PdfJavaScriptAction |
A PdfJavaScriptAction object specifying the action to be executed before the field value is formatted. |
Get gotFocus PdfAction
Get the action to be performed when the field receives the input focus.
Set gotFocus void
Set the action to be performed when the field receives the input focus.
| Parameter | Type | Description |
|---|---|---|
| value | PdfAction |
The action to be executed when the field receives the input focus. |
Get keyPressed PdfJavaScriptAction
Gets the JavaScript action run on each keystroke in a text field to validate or modify it.
Set keyPressed void
Sets the JavaScript action run on each keystroke in a text field to validate or modify it.
| Parameter | Type | Description |
|---|---|---|
| value | PdfJavaScriptAction |
A PdfJavaScriptAction object specifying the action to be executed when the user types a keystroke. |
Get lostFocus PdfAction
Get the action to be performed when the field loses the input focus.
Set lostFocus void
Set the action to be performed when the field loses the input focus.
| Parameter | Type | Description |
|---|---|---|
| value | PdfAction |
The action to be executed when the field loses the input focus. |
Get mouseDown PdfAction
Get the action to be performed when the mouse button is pressed inside the field’s area.
Set mouseDown void
Set the action to be performed when the mouse button is pressed inside the field’s area.
| Parameter | Type | Description |
|---|---|---|
| value | PdfAction |
The action to be executed when the mouse button is pressed inside the field area. |
Get mouseEnter PdfAction
Get the action to be performed when the mouse cursor enters the field area.
Set mouseEnter void
Set the action to be performed when the mouse cursor enters the field area.
| Parameter | Type | Description |
|---|---|---|
| value | PdfAction |
The action to be executed when the mouse enters the field area. |
Get mouseLeave PdfAction
Get the action to be performed when the cursor exits the fields area.
Set mouseLeave void
Set the action to be performed when the cursor exits the fields area.
| Parameter | Type | Description |
|---|---|---|
| value | PdfAction |
The action to be executed when the mouse exists the field area. |
Get mouseUp PdfAction
Get the action to be performed when the mouse button is released inside the field area.
Set mouseUp void
Set the action to be performed when the mouse button is released inside the field area.
| Parameter | Type | Description |
|---|---|---|
| value | PdfAction |
The action to be executed when the mouse released inside the field area. |
Get validate PdfJavaScriptAction
Gets the JavaScript action triggered when the field value changes for validation.
Set validate void
set the Java script action to the field for keyPressed.
| Parameter | Type | Description |
|---|---|---|
| value | PdfJavaScriptAction |
The action to be executed when the field is KeyPressed. |