freeDraw

fun freeDraw(width: Dp, height: Dp, block: FreeDrawScope.() -> Unit)

Appends a free-form vector drawing authored in a local coordinate space of (0, 0)(width, height) and scaled into the node's final rectangle. Use it for diagrams, decorations, or any shape the primitive nodes don't cover — everything stays sharp vector output.

Example — a warning triangle:

freeDraw(width = 60.dp, height = 60.dp) {
path(fill = PdfColor(1f, 0.8f, 0.2f), strokeColor = PdfColor.Black, strokeWidth = 2f) {
moveTo(30f, 4f); lineTo(56f, 52f); lineTo(4f, 52f); close()
}
}

Parameters

width

rendered width; also the local coordinate space width.

height

rendered height; also the local coordinate space height.