renderAnnotationsTo

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

Draws only the annotations annotations accepts, with none of the page's own content.

A viewer that keeps the drawn page and paints the form on top of it uses this: the page is rasterized once without its widgets, and a field a script changes is redrawn on its own.

page.renderTo(canvas, ctm) { it.subtype != PdfAnnotation.Subtype.Widget }  // the page
page.renderAnnotationsTo(overlay, ctm, state) { it.subtype == PdfAnnotation.Subtype.Widget }