PageRenderer

class PageRenderer(canvas: PdfCanvas, resolver: IndirectResolver)

The content-stream interpreter — translates parsed Operations into PdfCanvas draw calls while maintaining the full PDF graphics-state stack (ISO 32000-1 §8 + §9).

Architecture mirrors MuPDF's pdf_processor / pdf_op_run.c:

  1. Walk operations one by one.

  2. Mutate the GraphicsStack for state-changing ops.

  3. Accumulate path construction in a PdfPath.Builder.

  4. On paint operators, hand the path off to the device.

  5. Inside BT…ET, run the text state machine (Tm/Tlm/Tj/TJ/'/" etc.).

The interpreter is single-pass and stateless w.r.t. previous pages: every call to render starts with a fresh state stack.

Constructors

Link copied to clipboard
constructor(canvas: PdfCanvas, resolver: IndirectResolver)

Functions

Link copied to clipboard
fun render(page: PdfPage, deviceCtm: Matrix = defaultDeviceCtm(page))