mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-29 04:28:20 -06:00
`page_render` only returns PNG. A host that paints the page straight onto a canvas (a browser, a GPU texture) encodes a PNG only to decode it again, on every scroll. `render_pixels(doc, page, scale)` uses the same renderer and the same per-document cache as `page_render` and returns the width, the height and the RGBA pixels; `scale` is pixels per point (1.0 = 72 dpi). `Pixels` is re-exported so the caller can name the type. It validates like the tool does: the scale must be finite and within the tool's dpi limit, the page must exist (1-based), and the document must be open. The test checks the size agrees with `page_render` at 72 dpi, the buffer is RGBA, the scale doubles the width, and each refusal. This is an embedder API, not a user-facing feature, so it has no tool and no parity entry. Co-authored-by: Paulo Junior <195025778+bonfim6P@users.noreply.github.com> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>