happypdf / PDFJavaScriptAction
Class: PDFJavaScriptAction
Defined in: src/api/PDFJavaScriptAction.ts:17
Represents a JavaScript action extracted from a PDF. JavaScript actions can be attached to documents, pages, fields, and annotations.
Properties
dict
readonly dict: PDFDict;Defined in: src/api/PDFJavaScriptAction.ts:19
The underlying dictionary for this JavaScript action.
doc
readonly doc: PDFDocument;Defined in: src/api/PDFJavaScriptAction.ts:22
The document to which this action belongs.
ref?
readonly optional ref?: PDFRef;Defined in: src/api/PDFJavaScriptAction.ts:25
The reference to this action (if any).
Methods
getScript()
getScript(): string | undefined;Defined in: src/api/PDFJavaScriptAction.ts:56
Get the JavaScript code from this action.
Returns
string | undefined
The JavaScript code as a string
of()
static of(
dict,
doc,
ref?): PDFJavaScriptAction | undefined;Defined in: src/api/PDFJavaScriptAction.ts:40
Create a PDFJavaScriptAction from a dictionary.
Parameters
| Parameter | Type | Description |
|---|---|---|
dict | PDFDict | The action dictionary |
doc | PDFDocument | The document to which this action belongs |
ref? | PDFRef | The reference to this action (if any) |
Returns
PDFJavaScriptAction | undefined
A PDFJavaScriptAction instance or undefined if not a JavaScript action
setScript()
setScript(script): void;Defined in: src/api/PDFJavaScriptAction.ts:78
Set the JavaScript code for this action.
Parameters
| Parameter | Type | Description |
|---|---|---|
script | string | The JavaScript code to set |
Returns
void