PdfViewerAnnotation

data class PdfViewerAnnotation(val pageIndex: Int, val x: Float, val y: Float, val width: Float, val height: Float, val color: Color = DefaultHighlightColor)

One in-viewer highlight annotation, expressed in the same coordinate system as com.conamobile.pdfkmp.text.PdfTextRun and PdfSearchHighlight — PDF points, top-left origin, Y growing downward — so a highlight scales with pinch zoom exactly like a search-match rectangle does.

Honest scope: these annotations are an overlay only. They are held in viewer state and painted on top of the rasterised page; they are not written back into the encoded PDF bytes. The bytes handed to share / save / print are untouched, so a highlight is not visible if the same PDF is opened in another reader. Persist them yourself via KmpPdfViewer's onAnnotationsChanged callback (serialise the list) and restore through initialAnnotations — see that composable's KDoc.

Constructors

Link copied to clipboard
constructor(pageIndex: Int, x: Float, y: Float, width: Float, height: Float, color: Color = DefaultHighlightColor)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

fill colour painted over the page. Defaults to the translucent yellow DefaultHighlightColor, matching the look of a physical highlighter pen and the in-document search highlights.

Link copied to clipboard

height of the highlight box, in PDF points.

Link copied to clipboard

zero-based page the annotation belongs to.

Link copied to clipboard

width of the highlight box, in PDF points.

Link copied to clipboard
val x: Float

left edge of the highlight box, in PDF points.

Link copied to clipboard
val y: Float

top edge of the highlight box, in PDF points.