ApplePdfRasterizer
Headless rendering on Apple platforms (iOS, macOS, tvOS). Produces a PNG-encoded NSData sized by PdfPage.rasterGeometry (rotation, crop box and /UserUnit all included), at scale device pixels per point. Pure CoreGraphics + ImageIO, no UIKit/AppKit, no Compose dependency.
Typical uses:
Pre-rendering thumbnails on disk (
writeToFile:atomically:)Generating sharing previews / extension thumbnails
CI snapshots of PDF rendering
For drawing into a UIView's drawRect: (or an NSView) directly, instantiate CoreGraphicsCanvas over the current CGContext instead. The rasterizer is for off-screen output.
Functions
Render a page into a PNG-encoded NSData. Returns null if the underlying CGBitmapContext or PNG encoder can't be created (very rare; would indicate a system-level resource failure).
renderToPngData with an explicit allocation ceiling.