property JavaScriptActions: TPdfJavaScriptActions; // read only
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.
OpenAction).Length(Result) = 0 for a quick “no JS” check
without computing the count separately.
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]));