encodeToPng

fun encodeToPng(page: PdfPage, scale: Double = 1.0, background: Color = Color.WHITE): ByteArray

Returns PNG bytes ready to write to disk / a network response.


fun encodeToPng(page: PdfPage, scale: Double = 1.0, background: Color = Color.WHITE, maxPixels: Long): ByteArray

Returns PNG bytes with an explicit allocation ceiling.