renderTo

open override fun renderTo(canvas: KiteCanvas, deviceCtm: KiteMatrix)(source)

Render this page into a KiteCanvas (typically the Compose binding's ComposeCanvas). deviceCtm is applied on top of user-space. Pass an identity matrix for a 1pt = 1pt rendering, or a scaled / Y-flipped matrix to fit a UI surface.


open override fun renderTo(canvas: KiteCanvas, deviceCtm: KiteMatrix, cancellation: KiteCancellation)(source)

renderTo that stops between operators once cancellation reads true (#188).


fun renderTo(canvas: KiteCanvas, deviceCtm: KiteMatrix, formState: PdfFormState?, cancellation: KiteCancellation, annotations: (PdfAnnotation) -> Boolean = { true })(source)

renderTo with the form state, the annotation filter and a cancellation that stops the render between operators once it reads true. The page returns with the canvas closed and what it painted so far (#188).


fun renderTo(canvas: KiteCanvas, deviceCtm: KiteMatrix, annotations: (PdfAnnotation) -> Boolean)(source)

renderTo, drawing only the annotations annotations accepts. { false } renders the page content alone: for printing or exporting without markup, a clean thumbnail, or an editor that redraws its annotation layer on its own.

page.renderTo(canvas, ctm) { false }                                          // no annotations
page.renderTo(canvas, ctm) { it.subtype != PdfAnnotation.Subtype.Highlight } // hide highlights

fun renderTo(canvas: KiteCanvas, deviceCtm: KiteMatrix, formState: PdfFormState?, annotations: (PdfAnnotation) -> Boolean = { true })(source)

renderTo with the form being filled: a widget whose field has a value in formState is drawn from that value, and a field the state hides is not drawn. Pass null to render the file as it arrived.

val state = PdfFormState(doc)
state.setValue("name", "Ada")
page.renderTo(canvas, ctm, state) // the box shows Ada, whatever the file stores