4 ms·
Interesting. Just today I was looking for wkhtmltopdf replacement after a horrible experience with puppeteer and trying to run chromium headless (do NOT try to
by Fire-Dragon-DoL 2y ago
Interesting. Just today I was looking for wkhtmltopdf replacement after a horrible experience with puppeteer and trying to run chromium headless (do NOT try to run it with jemalloc in LD_PRELOAD). I did solve the problem, but I preferred the simplicity of a renderer.
- nicoburns 2y agoYou're not the first person to show interest in the PDF rendering use case. I think we'd probably need better support for some of the print-orientated CSS properties and page-based layout (for splitting layout across multiple discrete pages and controlling where page breaks occur), but it's definitely something that we ought to be able to support at some point.
- RamblingCTO 2y agoYou'd be a hero to a lot of people for supporting that. Current options for basic PDF reports suck. You essentially have to run Chrome (at scale possibly) for such a basic use case.
- nicoburns 2y agoIt's kinda early, but we're looking at collaborating with https://typst.app/ https://typst.app/ (a modern LaTeX alternative) on this. They already have some of the low-level PDF writing infrastructure in place, and are working on something higher-level that we're hoping to use. (you could also look at using Typst directly if you're not tied to HTML)
- nine_k 2y agoBTW why not render things in SVG and convert to.PDF then? It would certainly require you to compute your own layout, but you.normally want that in a tabular report anyway. The rendering would not involve invoking a web browser though.
- rescbr 2y agoI second this suggestion. For one use-case that it’s just a single page, I’m using SVG + rsvg-convert.
- Semaphor 2y agoWeasyprint [0] works pretty well for us. Especially for basic things, it does everything. It’s only lacking some very advanced CSS Print features. [0]: https://doc.courtbouillon.org/weasyprint/stable/ https://doc.courtbouillon.org/weasyprint/stable/
- Fire-Dragon-DoL 2y agoYeah I'm not in hurry, but having to write a layout with css 2 was very painful. I had to resort to floats, clearfix and similar things, so I'm looking forward this
- OtomotO 2y agoOh god, yes... Wkhtmltopdf is a resource hog. Other solutions have incomplete support for the HTML spec, so we can't quite create the pdfs we want (unless someone set down and figured it out with less modern features)
- cedws 2y agoCheck out gotenberg[0], it might fulfil your needs. I use it in GitHub Actions to convert my CV to PDF. [0]: https://github.com/gotenberg/gotenberg https://github.com/gotenberg/gotenberg
- Fire-Dragon-DoL 2y agoThat looks amazing
- MrPowerGamerBR 2y agoMy use case was a bit different: I was trying to use Chromium Headless in Playwright as a simple way to render a element on a page, I experienced tons of random "Page crashed" and "Timed out after 30s" from Playwright. Switched to Firefox Headless and these issues stop happening, in fact, switching to Firefox made the renderer ~3x FASTER than Chromium Headless! The Blitz project seems very interesting and is actually what I needed, because I'm using a headless browser as an alternative because rendering everything manually using Java Graphics2D would be a pain because the thing I'm rendering has a bit of a complex layout and I really didn't want to reinvent the wheel by creating my own layout engine.