PageRenderer

class PageRenderer(canvas: KiteCanvas, resolver: IndirectResolver, formState: PdfFormState? = null)

The content-stream interpreter. It translates parsed Operations into KiteCanvas 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 KitePath.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: KiteCanvas, resolver: IndirectResolver, formState: PdfFormState? = null)

Types

Link copied to clipboard
class XObjectSlot(val objectNumber: Long?, val stream: PdfStream)

An XObject with the indirect object number it resolved from (null for the rare ref-less inline entry). The number keys the decoded caches.

Functions

Link copied to clipboard
fun render(page: PdfPage, deviceCtm: KiteMatrix = defaultDeviceCtm(page), annotations: (PdfAnnotation) -> Boolean = { true })

Paints page under deviceCtm, then the annotations that annotations accepts. { false } leaves the page content on its own (#133).

Link copied to clipboard
fun renderAnnotations(page: PdfPage, deviceCtm: KiteMatrix = defaultDeviceCtm(page), annotations: (PdfAnnotation) -> Boolean = { true })

Paints only the annotations annotations accepts, and none of the page's own content.