Parser

class Parser(lexer: Lexer, resolver: IndirectResolver? = null)

Recursive-descent parser for PDF objects (ISO 32000-1 §7.3).

Drives a Lexer one token at a time. Handles the tricky one-token lookahead needed to distinguish "N G obj" headers, "N G R" references, and bare numbers inside arrays — see readArray for the gory details.

Pass a resolver (typically the owning io.github.yuroyami.kitepdf.PdfDocument) when parsing in a context where indirect references in stream dictionaries must be resolved on the fly — most importantly when /Length is an indirect reference, which MuPDF's pdf_stream_length() handles via pdf_dict_get_int64().

Constructors

Link copied to clipboard
constructor(bytes: ByteArray)
constructor(bytes: ByteArray, resolver: IndirectResolver?)
constructor(lexer: Lexer, resolver: IndirectResolver? = null)

Functions

Link copied to clipboard

Parse a full indirect object: "N G obj endobj". The reader must currently sit at the start of "N G obj".

Link copied to clipboard

Read exactly one PDF object from the current position.