SetXRefLoadPolicy

Document loading, Recovery, Security

Description

Selects how later selected-document and Direct Access opens validate and recover cross-reference tables, cross-reference streams and hybrid-reference chains

Syntax

Delphi

Function TPDFlib.SetXRefLoadPolicy(Policy: Integer): Integer;

Parameters

PDF_XREF_LOAD_STRICTRequires the PDF header at byte zero, an exact startxref target, a valid final %%EOF sequence, fixed-width table entries, valid cross-reference stream metadata and every declared /Prev or /XRefStm section
PDF_XREF_LOAD_COMPATIBLEPermits controlled compatibility handling for nearby offsets, shifted headers, null padding and known table or stream defects, but never reconstructs objects with a raw scan
PDF_XREF_LOAD_RECOVERYUses compatible parsing first and reconstructs top-level and compressed objects when no usable chain remains; missing trailer data may be synthesized from the newest recovered catalog

Return values

1The policy was accepted
0The policy was invalid and the previous setting was preserved

Remarks

Call this method before LoadFromFile, LoadFromStream, LoadFromString or a DAOpen method

The default is PDF_XREF_LOAD_RECOVERY for compatibility with earlier releases

SetRecoveryMode controls the depth of selected-document raw reconstruction after this policy permits recovery