Creates a new xref lookup instance.
Optionaloptions: {Configuration options
Optionalobject?: PdfXRefTable | PdfIndirectObject<PdfStream<PdfDictionary<PdfDictionaryEntries>>>Pre-existing xref table or stream object
Optionalprev?: PdfXrefLookupPrevious xref lookup to link to
OptionaltrailerDict?: PdfDictionary<PdfTrailerEntries>Pre-existing trailer dictionary
Optionaltype?: "stream" | "table"Type of xref ('table' or 'stream')
Map of object numbers to their xref entries
The underlying xref object (either a table or stream)
OptionalprevReference to the previous xref lookup in the revision chain
Trailer dictionary containing document metadata references
Gets all xref entries as an array.
Gets the byte offset of the xref object.
Gets the size of the xref table (highest object number + 1). Ensures size is at least as large as the previous revision.
Sets the size of the xref table.
Adds an indirect object to the xref lookup. Assigns an object number if not already set.
The indirect object to add
Optionaloptions: { indexInStream?: number; parentObjectNumber?: number }Options for compressed objects
OptionalindexInStream?: numberIndex within the object stream
OptionalparentObjectNumber?: numberObject number of the containing object stream
Gets an xref entry by object number. Falls back to the previous xref if not found in current entries.
The object number to look up
The xref entry or undefined if not found
Links xref entries to their corresponding indirect objects. Updates byte offset references to point to actual object offsets.
Array of indirect objects to link
Links this xref to a previous xref lookup based on the Prev trailer entry.
Array of xref lookups to search for the previous one
Removes an indirect object from the xref lookup. Also removes any trailer references to the object.
The indirect object to remove
Links this xref to a previous xref lookup. Copies missing trailer entries from the previous xref.
The previous xref lookup to link to
Generates the trailer section objects for this xref. Includes xref table/stream, trailer (if using table), startxref, and EOF.
Array of objects forming the trailer section
Updates the xref object with current entries. Handles both table and stream formats, including hybrid documents.
The updated xref object
StaticfromCreates xref lookups from an array of PDF objects. Parses both xref tables and xref streams, linking them via the Prev chain.
Array of PDF objects to parse
The most recent xref lookup with linked previous lookups
StaticfromCreates an xref lookup from an xref stream object.
The indirect object containing the xref stream
A new PdfXrefLookup instance
StaticfromCreates an xref lookup from a traditional xref table and trailer. Handles hybrid xref documents with both table and stream entries.
The xref table object
The trailer object
Optionalobjects: PdfObject[]Optional array of objects for resolving hybrid xref streams
A new PdfXrefLookup instance
Manages cross-reference (xref) lookup for PDF objects. Handles both traditional xref tables and xref streams, including hybrid documents. Supports linking multiple revisions through the Prev chain.