Topic: print css

2026-09-12 · 2 min read

PDF from HTML with headless Chrome

Use the Chrome binary you already have to turn an HTML file into a print-ready PDF or a pixel-exact PNG, without installing Puppeteer: the flags, a throwaway user-data-dir so you never touch the real profile, @page CSS for A5 books, page-break rules, and the file URL escaping that bites on Windows.

pdfchromeheadlessnode.js

← Guides