Skip to main content

Node

png is the encoded file. The PNG and the PDF come from the same layout, so they agree.

Browser

A page paints the layout on a <canvas>. Then you encode the canvas.

From the editor

If you show the document in the editor, the pages are already on screen:

From a layout

Without the editor, lay out the document and paint it with the viewer. With a bundler other than Vite, webpack or Next.js, first give the engine’s URL. See The layout engine.
Pass fontBytes. Without it, the canvas uses a local font with the same family name, and the text no longer sits where the layout put it. See Canvas viewer for @reductoai/viewer.

Thumbnails

For a small preview, paint at a low scale: