Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
11–20 of 170 posts
Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#12Earlier quoted context omitted.
doesn't pandoc rely on some engine itself?
Curious why that matters to you? I mean everything has dependencies (some of the solutions elsewhere require Chrome and other common solutions require the JVM). At least Pandoc is GPL.
Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#13Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#14Puppeteer 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 servi…
I documented the process here[0] if anyone needs examples of the CSS and loading web fonts. Apologies for the article being long-winded – it was the first one I published.
[0] https://johnh.co/blog/creating-pdfs-from-html-using-csharp
Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#15Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#16https://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?
#17pandoc
Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#18chrome --headless --disable-gpu --print-to-pdf https://example.com
ended up using headless chrome specifically to make sure javascript things rendered properly
Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#19Re: Ask HN: What is nowadays (opensource) way of converting HTML to PDF?
#20Earlier quoted context omitted.
doesn't pandoc rely on some engine itself?
Curious why that matters to you? I mean everything has dependencies (some of the solutions elsewhere require Chrome and other common solutions require the JVM). At least Pandoc is GPL.