happypdf / PDFJavaScript
Class: PDFJavaScript
Defined in: src/api/PDFJavaScript.ts:10
Represents JavaScript that has been embedded in a [[PDFDocument]].
Implements
Properties
doc
readonly doc: PDFDocument;Defined in: src/api/PDFJavaScript.ts:29
The document to which this embedded script belongs.
ref
readonly ref: PDFRef;Defined in: src/api/PDFJavaScript.ts:26
The unique reference assigned to this embedded script within the document.
Methods
embed()
embed(): Promise<void>;Defined in: src/api/PDFJavaScript.ts:53
> NOTE: You probably don't need to call this method directly. The > [[PDFDocument.save]] and [[PDFDocument.saveAsBase64]] methods will > automatically ensure all JavaScripts get embedded.
Embed this JavaScript in its document.
Returns
Promise<void>
Resolves when the embedding is complete.
Implementation of
of()
static of(
ref,
doc,
embedder): PDFJavaScript;Defined in: src/api/PDFJavaScript.ts:22
> NOTE: You probably don't want to call this method directly. Instead, > consider using the [[PDFDocument.addJavaScript]] method, which will create instances of [[PDFJavaScript]] for you.
Create an instance of [[PDFJavaScript]] from an existing ref and script
Parameters
| Parameter | Type | Description |
|---|---|---|
ref | PDFRef | The unique reference for this script. |
doc | PDFDocument | The document to which the script will belong. |
embedder | JavaScriptEmbedder | The embedder that will be used to embed the script. |
Returns
PDFJavaScript