THotPDF.AddLoadedDocumentJavaScript Method
Adds a document-level JavaScript to a loaded PDF, or replaces the script of an existing name. The script is stored as a JavaScript action in the Catalog /Names /JavaScript name tree at its sorted position and is written by the next SaveLoadedDocument or incremental update; GetLoadedJavaScriptSource returns it right away
Declaration
procedure AddLoadedDocumentJavaScript(const AName, ABody: AnsiString);
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
AName | PDF resource name, packet name, profile name, or caller-defined identifier |
ABody | Input used by AddLoadedDocumentJavaScript |
Return value
This member does not return a value
Usage notes
- Use this API in the document creation workflow before the affected page, resource, field, or catalog object is finalized
- Keep object names, field names, resource names, and returned handles stable until the document is finalized
- Loaded-document object references may be indirect; resolve arrays, dictionaries, or streams before inspecting nested values