Skip to content

How the playground draws the page

Most live HTML-to-PDF previews are a browser rendering the markup, beside a PDF made by another program, so the two can differ. The playground lays the document out once, with the engine that writes the PDF, and draws that one layout twice: on the canvas, and into the file you download.

One layout, two pictures

The engine, compiled to WebAssembly, has two calls. render() returns the PDF’s bytes; scene() returns the display list those bytes are written from: the same boxes, the same page breaks, the same shaped lines of text, and what the pages add, such as running headers, page numbers, footnotes and table headers repeated on a new page. The canvas paints that list.

When we measured it on the playground’s earlier sample, a paged report, the canvas and the downloaded PDF drawn at the same size differed on 0.03 % of the pixels of the page-number band and 1.6 % of the whole page, all of them at the anti-aliased edges of glyphs and shapes, where two rasterisers never agree.

Nothing is uploaded

The engine is loaded into a worker in your browser, once, with the fonts it falls back on. There is no server behind the playground, which is why it keeps working with the network off. The counter in its toolbar shows how long the last layout took on your machine.

A document that links to files on other sites — pictures, web fonts, style sheets — gets them from your browser, without cookies, and only from sites that allow it (CORS). The print’s own limits apply: at most 100 files and 64 MB a document. Our server sees none of it.

A PDF downloaded from the playground carries a faint mark across the middle of each page. Headers and footers stay as the document sets them.

The two tabs

Template is the HTML and CSS of a whole document. CSS for pages works: @page sizes and margins, named pages of different sizes, forced breaks, running headers with position: running(), counter(page) and float: footnote. The paper size is the document’s own @page.

Data is a JSON object. {{ variable }} and {% for %} are filled from it before layout, with the filters of the server’s template renderer: currency, date, number_format and slice.

How much CSS it does

The engine runs the web-platform tests, the tests browsers are judged by, and every result is published, failures included. In the run of 8 November 2026, 27,676 of the 29,323 files it is judged on pass with every subtest green (94.4%). Every test, with our render and the reference.

The API

The same engine prints through the HTTP API v1 at api.reflowpdf.com, with SDKs; its documentation lists the options, PDF/UA and PDF/A among them. API documentation.

To edit documents without writing HTML, use the editor: it runs on the same engine, and imports a PDF you already have. Open the editor.