Most HTML-to-PDF comparisons are feature lists. We measured instead. We took three real documents (a one-page invoice, a four-page invoice and a two-page report) and twelve small CSS fixtures. We rendered them with every HTML-to-PDF engine installed on one development machine, then timed each render and checked each output automatically.
The engines were Google Chrome driven four different ways, a Chrome for Testing build in two modes, and macOS WebKit. The short version:
- Browser start-up is most of the cost of a one-off render. Starting Chrome for each document took about 410 to 490 ms (median). Rendering in an already-open Chrome took about 120 to 170 ms.
- The headless mode matters more than the version. The same Chrome for Testing build rendered about three to four times faster as
chrome-headless-shell(49 to 74 ms) than as the full browser in headless mode (179 to 216 ms). - Tagged PDFs cost file size, not time. Turning on tagging made files 29 to 103 percent larger, with render times within a few percent. The Chrome command line produced tagged PDFs by default; Playwright's
page.pdf()did not. - All Chromium variants passed all eleven paged-media checks. WebKit's macOS print path failed six:
@pagesize, margin boxes, named pages, repeated table headers, repeated fixed elements and the PDF title. Its files were less than half the size.
Everything here ran locally. No hosted API, ours or anyone else's, was measured. The last sections explain what that leaves out and how to rerun the test.
What we tested
| ID | Engine | Version | How it was driven | Includes browser start? |
|---|---|---|---|---|
| chrome-playwright-warm | Google Chrome | 158.0.8127.36 | playwright-core 1.65.1, page.pdf(), one browser kept open | No |
| chrome-playwright-warm-tagged | Google Chrome | 158.0.8127.36 | Same, with tagged: true | No |
| chrome-playwright-cold | Google Chrome | 158.0.8127.36 | Launch, render, close for every document | Yes |
| chrome-cli | Google Chrome | 158.0.8127.36 | chrome --headless --print-to-pdf, one process per document | Yes |
| cft-chrome-warm | Chrome for Testing | 153.0.8010.12 | Full browser in headless mode, page.pdf(), kept open | No |
| headless-shell-warm | chrome-headless-shell | 153.0.8010.12 | page.pdf(), kept open | No |
| webkit-print | macOS WebKit | WebKit.framework 22625.1.29.11.27 | WKWebView print operation to a PDF file, process kept open | No |
All Playwright runs used the same options: A4, printBackground: true, preferCSSPageSize: true. Playwright documents both printBackground and tagged as defaulting to false. The Chrome command line used --headless --disable-gpu --no-pdf-header-footer --print-to-pdf. WebKit was driven through AppKit's print operation, set to A4 paper with zero print margins so CSS controls the margins.
Chrome's documentation explains the two headless variants. Since Chrome 132, the old headless implementation ships only as a separate chrome-headless-shell binary, and the regular browser has a headless mode that shares the full browser's code. The cft-chrome-warm and headless-shell-warm rows are the same Chrome for Testing build in those two forms. That makes them a direct test of mode, separate from version.
Engines we could not test because they are not installed on the machine: wkhtmltopdf, WeasyPrint, Prince, PDFreactor, Typst and LibreOffice. We did not install system software for this test.
Fixtures and checks
The document fixtures are the public sample templates merged with their sample data:
- invoice: the invoice template with sample data, one page
- invoice-long: the same template with 60 line items, four pages
- report: the report template with sample data. It has two pages, a table header that repeats, and page numbers in
@pagemargin boxes.
The feature fixtures are small HTML files, one per behaviour, each paired with an automated check on the PDF:
| Fixture | Passes when |
|---|---|
| page-size | @page { size: Letter landscape } gives a 792 x 612 pt page |
| margin-boxes | Every page carries "Page N of 3" from @bottom-center with counter(page) and counter(pages) |
| break-before | break-before: page puts sections 1, 2 and 3 on pages 1, 2 and 3 |
| break-inside-avoid | A 25-line block that would straddle a page break stays on one page |
| break-inside-control | The same block without break-inside: avoid splits. This proves the previous check can fail. |
| thead-repeat | A 150-row table's header row appears on every page |
| named-pages | A section with page: wide gets its own A4 landscape page |
| print-background | A red background band is drawn in the PDF |
| fixed-element | A position: fixed header appears on all three pages |
| links | An <a href> becomes a clickable link annotation |
| title | The HTML <title> becomes the PDF Title |
| webfont | A font loaded with @font-face (Liberation Sans, SIL OFL) is embedded |
Page-margin boxes, the size descriptor and named pages are defined in CSS Paged Media Level 3, still a W3C Working Draft. break-before and break-inside come from CSS Fragmentation Level 3, a Candidate Recommendation. Both specifications are in the sources.
Method
The machine was an Apple M4 Max with 16 cores and 48 GB of memory, running macOS 27.0 and Node.js 24.5. Each warm engine rendered every document fixture 3 times as warm-up and then 50 times measured. Cold Chrome and the Chrome command line ran once as warm-up and then 20 times, because each run starts a new browser. A render's time runs from opening a new page (or starting the process) to having the complete PDF bytes. The engines ran one after another, never in parallel. Other work was running on the machine, and the one-minute load average was between 6 and 10 during the run. Treat the numbers as relative, and expect your p95 to differ.
PDFs were analysed with pdf-lib 1.17.1 (page sizes, metadata, tagging, embedded fonts) and pdfjs-dist 5.7.284 (text per page, link annotations, fill colours). Every output PDF is published next to its fixture under /samples/fixtures/rendering-benchmark/outputs/.
Results: render time
Median / p95 in milliseconds:
| Engine | invoice (1 page) | invoice-long (4 pages) | report (2 pages) |
|---|---|---|---|
| headless-shell-warm | 49.5 / 52.2 | 73.7 / 76.8 | 54.4 / 66.5 |
| webkit-print | 63.1 / 69.5 | 79.7 / 84.4 | 71.6 / 78.7 |
| chrome-playwright-warm | 121.4 / 157.9 | 162.6 / 175.7 | 127.4 / 134.2 |
| chrome-playwright-warm-tagged | 125.6 / 167.1 | 171.4 / 180.9 | 132.8 / 138.6 |
| cft-chrome-warm | 205.4 / 307.3 | 215.9 / 372.6 | 179.3 / 188.7 |
| chrome-cli | 412.9 / 546.1 | 477.6 / 538.6 | 483.2 / 836.2 |
| chrome-playwright-cold | 419.5 / 686.1 | 494.3 / 560.2 | 412.6 / 432.2 |
Results: output size and structure
| Engine | invoice bytes | invoice-long bytes | report bytes | Tagged | Producer |
|---|---|---|---|---|---|
| chrome-playwright-warm and -cold | 63,998 | 89,108 | 113,951 | No | Skia/PDF m158 |
| chrome-playwright-warm-tagged | 82,441 | 180,465 | 167,966 | Yes | Skia/PDF m158 |
| chrome-cli | 82,441 | 180,465 | 167,966 | Yes | Skia/PDF m158 |
| cft-chrome-warm | 63,938 | 88,947 | 113,844 | No | Skia/PDF m153 |
| headless-shell-warm | 63,817 | 88,826 | 113,723 | No | Skia/PDF m153 |
| webkit-print | 29,560 | 39,234 | 44,234 | No | Quartz PDFContext |
Page counts matched across all engines: 1, 4 and 2. The Chrome command-line files had exactly the same byte sizes as the Playwright tagged: true files, which fits with the CLI tagging by default. Every Chromium variant embedded 11 font subsets in the report; WebKit embedded 3.
Results: feature checks
| Check | All six Chromium variants | macOS WebKit |
|---|---|---|
| page-size | Pass | Fail: A4 portrait (595 x 842) |
| margin-boxes | Pass | Fail: no footer text on any page |
| break-before | Pass | Pass |
| break-inside-avoid | Pass | Pass |
| break-inside-control (must split) | Pass | Pass |
| thead-repeat | Pass | Fail: header on page 1 of 7 only |
| named-pages | Pass | Fail: one portrait page |
| print-background | Pass | Pass |
| fixed-element | Pass | Fail: header on page 1 only |
| links | Pass | Pass |
| title | Pass | Fail: no Title |
| webfont | Pass | Pass |
What the numbers say
Keep the browser open
A cold render paid roughly 300 ms of browser start-up on top of the work itself: 413 to 494 ms median, against 121 to 163 ms warm for the same Chrome. The command line, which also starts a browser per document, landed in the same range. If you run your own renderer, a long-lived browser (or a small pool) with a fresh page per document is the first optimisation. Starting a browser per request is the most expensive way to render. A hosted API runs that pool for you; the cost then shows up as network and queueing time instead, which this test does not measure.
Headless shell vs full headless Chrome
The same Chrome for Testing 153 build rendered about 3 to 4 times faster as chrome-headless-shell than as the full browser in headless mode. Chrome 158 in full headless mode was faster than the 153 full browser, but still more than twice as slow as the shell. We changed only the binary, not the code, so the gap comes from the mode. That does not settle which to use. Chrome's documentation describes the shell as the old headless implementation and the regular headless mode as the one that shares the full browser's code. Our feature checks found no difference between them, but our fixtures are not the whole web platform.
Tagging is a size decision
Tagged PDFs carry a structure tree that assistive technology and reflow tools use. Turning tagging on added 29 percent to the invoice, 47 percent to the report and 103 percent to the 60-line invoice, whose large table adds many structure elements. Render time moved by 3 to 6 percent, inside run-to-run noise on this machine. If accessibility matters for your documents, tagging is close to free in time. Our PDF accessibility guide covers what tagging does and does not fix. Know your default, though: here the Chrome CLI tagged and Playwright did not.
WebKit's print path is fast, small and not paged-media aware
macOS WebKit through AppKit printing produced the smallest files, rendered the invoice and report legibly, and kept page breaks, break-inside: avoid, backgrounds, links and web fonts. It ignored @page size and named pages, printed no margin boxes, repeated neither table headers nor fixed elements, and wrote no Title. Every Chromium variant handled all of these. For documents that depend on page numbers in @page margin boxes, repeated headers or mixed orientations, those failures rule it out as tested. Other WebKit embeddings may behave differently from this print path. The CSS for HTML-to-PDF guide and the headers and footers guide show how to write these features for Chromium.
What we did not measure
- Any hosted API. This includes SublimePDF's. There are no production numbers here, and none should be inferred. A hosted service adds network transfer, authentication, queueing and storage, and removes browser start-up from your side.
- Visual fidelity. The checks read text, geometry and metadata. They do not compare kerning, anti-aliasing or colour.
- Concurrency and memory. Every render ran alone. Throughput under parallel load and memory per browser are separate tests.
- Other platforms. One Apple Silicon Mac, with other work running. Linux servers, where most renderers run, may give different absolute numbers.
- The other engines listed above, which were not installed.
Reproduce it
The script, fixtures and raw results are in the repository. With Node.js 22 or later, Google Chrome, Playwright's Chromium builds and the Xcode command-line tools (for the WebKit helper) installed:
node scripts/research/rendering-benchmark/run.mjs
# quicker smoke run
RUNS_WARM=5 RUNS_COLD=3 node scripts/research/rendering-benchmark/run.mjsThe script writes every fixture to /samples/fixtures/rendering-benchmark/, one PDF per engine and fixture to its outputs/ folder, and every timing sample to results.json. To test a hosted API on the same inputs, send the same HTML files and apply the same checks to the PDFs it returns. The SublimePDF vs PDFShift comparison lists what to compare, and the HTML to PDF API page shows how to call SublimePDF with your own HTML or a saved template.
Sources
- CSS Paged Media Module Level 3 (W3C Working Draft, 14 September 2023) · accessed 23 November 2026
- CSS Fragmentation Module Level 3 (W3C Candidate Recommendation, 4 December 2018) · accessed 23 November 2026
- Playwright: page.pdf() options · accessed 23 November 2026
- Chrome for Developers: Chrome Headless mode · accessed 23 November 2026
- Chrome for Developers: chrome-headless-shell · accessed 23 November 2026