GetXRefDiagnostics

Document management, Diagnostics, Recovery

Description

Returns a JSON report for the cross-reference and recovery path used to load the selected document

Syntax

Delphi

Function TPDFlib.GetXRefDiagnostics: WideString;

Return values

Empty stringNo loaded document is selected and LastErrorCode is set to 401
JSON reportThe report was returned

Report fields

File positionsfileSize, headerOffset, startXRefTokenOffset, declaredStartXRef, effectiveStartXRef, eofOffset and trailingBytes
Cross-reference summarypolicy is strict, compatible or recovery; xrefType is table, stream, hybrid, mixed or unknown; hasXRefStream, hybrid, shiftedHeader, sectionCount and trailerCount describe the selected chain
Entry countsentries reports allocated slots and free, in-use, compressed and invalid entries
Decisionsdecisions reports selected chain types, followed links, compatibility repairs and rejected sections in evaluation order
SectionsEach item reports declared and physical offsets, table or stream type, startxref, prev or xrefstm source, inclusive trailer dictionary boundaries, linked offsets, parse attempt, compatibilityFlags and success state
Recoveryrecovery reports strict, repair or best-effort mode, whether fallback was attempted and succeeded, recovered object counts, the trailer source and ordered decisions

Remarks

All byte positions are zero-based; unavailable positions are reported as -1

A shifted-header retry remains visible as attempt 2 so the declared and effective positions can be compared without hiding the failed first attempt

Recovery decisions can include raw-object-scan, recover-object-stream-members and synthesize-trailer