PdfPageRasterizer
Headless raster output for a PdfPage using Skia (no Compose).
Typical use cases:
Server-side thumbnail / preview generation
"PDF → PNG" CLI converters
CI screenshot baselines for visual regression tests
Embedding rendered PDF previews into non-Compose JVM UIs (AWT, Swing, JavaFX) by drawing the returned Image / ByteArray through their own image APIs.
The result is a sRGB raster sized by PdfPage.rasterGeometry (rotation, crop box and /UserUnit all included), at scale device pixels per PDF user-space point. Pass scale = 2.0 for retina / "2× density" thumbnails.
Functions
Convenience: render and return PNG bytes.
encodeToPng with an explicit allocation ceiling.
Render page into a freshly-allocated Skia Image. The caller owns the returned object and should call close() (or use encodeToPng) once done. Skia images hold off-heap memory.
renderToImage with an explicit allocation ceiling.