HelpBot Assistant

How can I help you?

PdfJavaScriptAction

16 Mar 20261 minute to read

Represents a JavaScript action in PDF document.
```typescript
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data);
// Access text box field
let field: PdfTextBoxField = document.form.fieldAt(0) as PdfTextBoxField;
// Create a new PdfJavaScriptAction for adding the action
field.actions.keyPressed = new PdfJavaScriptAction(‘AFDate_KeystrokeEx(“m/d/yy”)’);
field.actions.format = new PdfJavaScriptAction(‘AFDate_FormatEx(“m/d/yy”)’);
field.actions.validate = new PdfJavaScriptAction(‘AFDate_Validate(“m/d/yy”)’);
// Save the document
document.save(‘output.pdf’);
// Destroy the document
document.destroy();

Properties

Get next PdfAction

Get the next action to be performed after the action represented by this instance.

Set next void

Set the next action to be performed after the action represented by this instance.

Parameter Type Description
value PdfAction The next action to be executed.

Get script string

Gets the JavaScript code to be executed when this action is executed.

Set script void

Sets the JavaScript code to be executed when this action is executed.

Parameter Type Description
value string A string value representing valid JavaScript code to be executed.