I'm using wkhtmltopdf but it is painful to work with? what are other people using nowadays? i.e canva or other tools?
Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
1–10 of 170 posts
Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#2pandoc
Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#3pandoc
doesn't pandoc rely on some engine itself?
Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#4I run chromium on my server and render the PDF from there using puppeteer.
Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#5Puppeteer 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
Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#6https://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.
Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#7Just print to PDF in a browser, or automate that using a browser automation tool. For a non-browser-based open source solution, WeasyPrint.
For a proprietary solution, try Prince XML:
Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#8Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#9Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#10if you are doing html to pdf, you might also need the ability to merge. a few more features and you're better of with a commercial solution.