PDFiumVCL Docs

JavaScriptActions property

Dieser API-Eintrag behält Bezeichner, Signaturen, Codeblöcke und PDF-Begriffe in ihrer Originalform.
Component: TPdf  ·  Unit: PDFium
All document-level JavaScript actions returned as a single dynamic array.

Syntax

property JavaScriptActions: TPdfJavaScriptActions; // read only

Description

JavaScriptActions materialises every document-level JavaScript action into one dynamic array of TPdfJavaScriptAction records. Each record carries the action’s name (typically the entry key in the catalog’s /Names /JavaScript name tree, e.g. OpenAction, App.calc) and the script source decoded as WString. The array length equals JavaScriptActionCount.

The result is empty when Active is False or when the PDF contains no document-level scripts. JavaScriptActions is more convenient than looping JavaScriptAction[Index] when you need every entry — one allocation, one parse, ready for grouping or filtering. For very large script collections, prefer the indexed accessor to avoid materialising every script body up front.

PDFiumVCL exposes scripts as inspection data only — it does not execute, sandbox or transform them. Use the array to surface a “contains JavaScript” warning, to strip scripts before redistribution (combine with a low-level FPDFDoc_* mutation pass), or to feed an external analyser. Field- and annotation-level scripts live elsewhere and are not part of this array.

Remarks

Example

var Scripts: TPdfJavaScriptActions;
var I: Integer;
Scripts := Pdf1.JavaScriptActions;
for I := 0 to High(Scripts) do
  Memo1.Lines.Add(Format('[%s] %s',
    [Scripts[I].Name, Scripts[I].Script]));

See Also

JavaScriptAction, JavaScriptActionCount, Permissions