SetFormScriptLimits

Forms, JavaScript safety

Description

Configures independent limits for form-script source length, interpreter operations, parser nesting, string values and object-property accesses

Syntax

Delphi

Function TPDFlib.SetFormScriptLimits(MaxScriptLength, MaxOperations, MaxNestingDepth, MaxStringLength, MaxPropertyAccesses: Integer): Integer;

ActiveX

Function PDFlib::SetFormScriptLimits(MaxScriptLength As Long, MaxOperations As Long, MaxNestingDepth As Long, MaxStringLength As Long, MaxPropertyAccesses As Long) As Long

Available on IPDFlibrary4 from type library version 3.5

DLL

int DLSetFormScriptLimits(int InstanceID, int MaxScriptLength, int MaxOperations, int MaxNestingDepth, int MaxStringLength, int MaxPropertyAccesses);

Parameters

MaxScriptLengthSource-character limit from 1,024 to 1,048,576
MaxOperationsInterpreter-operation limit from 64 to 1,000,000
MaxNestingDepthParser nesting limit from 8 to 256
MaxStringLengthPer-string character limit from 1,024 to 16,777,216
MaxPropertyAccessesObject-property access limit from 16 to 1,000,000

Return values

Returns 1 when all limits are accepted, or 0 with LastErrorCode 708 when any value is outside its range

Remarks

The defaults are 65,536 source characters, 4,096 operations, 64 nesting levels, 1,048,576 string characters and 4,096 property accesses

The same limits apply to direct field-event execution, recalculation and dependency analysis

These configurable limits apply to the AcroForm JavaScript subset; XFA FormCalc has separate fixed bounds documented by EvaluateXFAFormCalc

See also

GetFormScriptLimitsJSON, GetFormScriptDiagnostics, ExecuteFormFieldScriptEvent