PDFium Delphi Component Docs

GetWidgetAdditionalActionJavaScript method

Component: TPdf  ·  Unit: PDFium
Read the JavaScript of one additional action attached to a form-field widget

Syntax

function GetWidgetAdditionalActionJavaScript(AnnotIndex: Integer; EventType: Integer): WString;

AnnotIndexInteger. Zero-based index of the widget annotation on the current page
EventTypeInteger. Which additional action to read, one of the FPDF_ANNOT_AACTION_* values: FPDF_ANNOT_AACTION_KEY_STROKE (12), FPDF_ANNOT_AACTION_FORMAT (13), FPDF_ANNOT_AACTION_VALIDATE (14), FPDF_ANNOT_AACTION_CALCULATE (15)
ResultWString. The script source, or an empty string when the widget has no such action

Description

Form fields can carry per-event scripts (ISO 32000-1 12.6.3): a keystroke filter, a format routine that rewrites what the field displays, a validation routine and a calculation that derives one field from others. This reads the source of one of them

It is a read-only view intended for auditing and migration - the script is returned as text rather than executed. Document-level scripts are listed by JavaScriptActions instead

An empty result also covers the case where the form layer is not active or the PDFium build lacks the entry point, so a caller who needs the distinction should check FormHandle first

See Also

JavaScriptActions, JavaScriptAction, FormFieldInfo, FormHandle