SetParserLimits

Document loading, security, performance

Description

Sets hard limits for nested PDF objects, entries in one directly parsed container and tolerated parser errors

Syntax

Delphi

Function TPDFlib.SetParserLimits(MaxNesting, MaxContainerItems: Integer): Integer; Overload;
Function TPDFlib.SetParserLimits(MaxNesting, MaxContainerItems, MaxErrors: Integer): Integer; Overload;

Parameters

MaxNestingThe maximum nested array and dictionary depth, at least 1
MaxContainerItemsThe maximum items in one array or dictionary, or 0 for no item limit
MaxErrorsThe maximum tolerant parser errors before parsing stops, or 0 for no error-count limit

Return values

1The limits were accepted
0MaxNesting was less than 1 or another limit was negative

Remarks

The two-parameter overload preserves the configured error limit

The limits apply to documents already owned by the instance and to every document created by later file, stream, string, edit-journal, QDF and integrity-check loading paths

Set strict limits before loading untrusted input, and use 0 for an unrestricted container size or error count