HACKER Q&A
📣 hhthrowaway1230

What is nowadays (opensource) way of converting HTML to PDF?


I'm using wkhtmltopdf but it is painful to work with? what are other people using nowadays? i.e canva or other tools?


  👤 throw03172019 Accepted Answer ✓
I run chromium on my server and render the PDF from there using puppeteer.

👤 zja
pandoc

👤 kappadi3
Puppeteer and Playwright are the main open-source options nowadays, both solid for HTML → PDF once your print CSS is sorted. Don’t forget proper page breaks (break-before/after/inside) — e.g. break-after: page works in Chromium, while always doesn’t. For trickier pagination you can look at Paged.js, and I’d test layouts in Chrome/Edge before automating.

Shameless plug: I run yakpdf.com, a hosted Puppeteer-based service if you want to avoid self-hosting. https://rapidapi.com/yakpdf-yakpdf/api/yakpdf


👤 mightjustwork
https://gotenberg.dev/ ...has been working well for me for the last few years. It's a headless instance of Google Chrome with a golang wrapper. Runs well in Docker or a cloud instance.