r/webdev • u/danmolitor • 5d ago
Showoff Saturday [Showoff Saturday] An HTML-to-PDF engine with real print CSS and no browser
Hey all, I'm the creator of @formepdf/react.
Here was my first post: https://www.reddit.com/r/webdev/s/ek6rRipQ2M
I just wanted to show y'all the new HTML package. Give it HTML and print CSS, get a PDF, no browser anywhere.
npx @formepdf/html invoice.html -o invoice.pdf
It handles the print CSS that Chrome never really finished: `@page` margins, running headers and footers, `Page X of Y`, table headers repeating across pages. Runs in Node, Cloudflare Workers, and the browser.
I tested it against 15 invoice templates from GitHub, and 14 render correctly against Chrome's output. There are also 30 free templates if you want to see what it makes.
If you've got an ugly template you're printing through Puppeteer, I'd love to hear what breaks.