const char* __stdcall pdfExecuteJavaScriptA(PPDF IPDF, const char* Script, const char* FieldsJSON);
const char* __stdcall pdfGetJSConsole(PPDF IPDF);
function pdfExecuteJavaScriptA(const IPDF: PPDF; const Script, FieldsJSON: PAnsiChar): PAnsiChar; stdcall;
function pdfGetJSConsole(const IPDF: PPDF): PAnsiChar; stdcall;
Purpose. Execute a JavaScript snippet against an embedded, real ECMAScript engine with an Acrobat-compatible host object model — per an inline source comment, "Lumas extension: real JavaScript execution (BESEN ECMAScript engine + Acrobat host)" — and read back the accumulated console output (console.log-style diagnostics) from the most recent execution.
Description. FieldsJSON supplies a JSON-encoded initial field-value context the script can read/manipulate (this.getField(...)-style Acrobat API calls resolve against it). This is real script execution, not a stub — a notable capability beyond the classic API's typical scope, called out explicitly as a "Lumas extension."
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle. |
Script | JavaScript source to execute. |
FieldsJSON | JSON field-value context available to the script. |
Return value. pdfExecuteJavaScriptA: pointer to the script's result (transient buffer), or nil if IPDF is invalid. pdfGetJSConsole: pointer to the accumulated console output; nil if IPDF invalid.
See also. pdfGetJSFields (not covered in this volume).
C# (P/Invoke)
public static extern IntPtr pdfGetJSConsole(IntPtr IPDF);
Getters
pdfGetJSConsole
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.