▲ | socalgal2 4 days ago | |||||||||||||||||||||||||
Maybe this isn't the same but it's a relatively few lines of code to use puppeteer to use an actual browser to render pages to PDFs/PNGs. Advantages would be everything is supported. Every new feature in CSS, HTML, SVG, Canvas2D, WebGL, WebGPU, etc... (though for WebGL/WebGPU you might need to pass in some flags to use llvmpipe/mesa/warp etc... Asking your favorite LLM will give you da codez PS: I'm not trying to discount this tool. I'm only pointing out an alternative that might be useful | ||||||||||||||||||||||||||
▲ | sammycage 4 days ago | parent | next [-] | |||||||||||||||||||||||||
That’s a good point. Using Puppeteer or a headless browser gives you essentially full web platform support. The tradeoff is that it comes with a heavier runtime and more moving parts (Chromium, Node, etc.). PlutoPrint aims to be much lighter: no browser dependency, just a compact C++ engine with a Python wrapper. It does not cover the entire browser feature set but it is fast, portable, and easy to drop into projects without the overhead of a full browser. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | slig 4 days ago | parent | prev | next [-] | |||||||||||||||||||||||||
Exactly what I was wondering. I use puppeteer to render these [1] printable puzzles pages, and I use SVG, JavaScript to dynamically resize the text to fit a page, etc. Just works. [1]: https://ahapdf.nyc3.cdn.digitaloceanspaces.com/samplers/logi... (PDF) | ||||||||||||||||||||||||||
▲ | strbean 2 days ago | parent | prev [-] | |||||||||||||||||||||||||
Gotenberg[0] wraps up Chromium nicely for this purpose. However, at scale, spinning up Chromium for each PDF you want to generate is painful. I'd definitely consider a solution like PlutoPrint. |