Headless Cross References

HPDFHeadlessXRef supplies the validated xref-stream and object-stream indexing used by THPDFHeadlessDocument; dictionaries and object-stream headers use the shared object parser, whilst big-endian fields use the shared Direct File byte reader

HPDFHeadlessDecodeXRefRows(Dictionary, DecodedBytes, MaxObjects, CancellationToken) reads direct Type, Size, W and optional Index entries after the caller has decoded filters and predictors

THPDFHeadlessXRefRows is an array of THPDFHeadlessXRefRow records containing ObjectNumber and the shared THPDFDirectXrefEntry as Entry; entry kinds zero, one and two identify free, direct and compressed objects

Widths range from zero to eight bytes, omitted fields use PDF defaults, offsets retain Int64 precision, and subsection overlaps, payload-length mismatches, out-of-range generations and unsigned overflow are rejected before indexing objects

HPDFHeadlessReadObjectStreamIndex(Dictionary, DecodedBytes, MaxObjects, MaxDecodedBytes, CancellationToken) validates direct Type=ObjStm, N and First, then parses the numeric header through the shared parser

THPDFHeadlessObjectStreamMembers is an array of THPDFHeadlessObjectStreamMember records with ObjectNumber, zero-based decoded-payload Offset and positive Length; duplicate object numbers, noninteger pairs, invalid offsets and configured budgets are rejected

HPDFHeadlessObjectStreamBody(Members, DecodedBytes, MemberIndex, ExpectedObjectNumber) yields the exact member slice after checking the authoritative xref member number against its container header; the document caller parses that slice through the shared parser

EHPDFHeadlessXRefError reports a message and read-only LimitExceeded flag, whilst cancellation raises EHPDFOperationCancelled; callers own dictionaries and decoded buffers, and returned arrays contain value records

The provider handles byte indexing and validation; revision precedence, hybrid side-section merging, filter decoding, decryption, object caching and document ownership remain with the document loader

Exact numeric values

The shared parser retains the original source token when conversion to Single would round the value or its magnitude exceeds 16777216; cross-reference and object-stream integer readers prefer that token for exact Int64 offsets and indices, whilst small exact integers retain the allocation-efficient path

Tests use the shared writer and independent compressed-object PDFs, exercise 40-bit offsets, widths/defaults, predictors, sparse ranges, hybrid precedence, malformed member indices and revision cycles, and preserve the original parser allocation and throughput thresholds