3 ms·
Slightly off topic but does anyone work with server generated charts at all? Or is there not much demand for pdf reports? Last I checked, converting Javascript
by wilsonfiifi 5y ago
Slightly off topic but does anyone work with server generated charts at all? Or is there not much demand for pdf reports?
Last I checked, converting Javascript charts to PNG is still a hacky/convoluted process.
- mgkimsal 5y agoI have a need for this as well. Many of the go-to packages from years ago seem abandoned.
- brianshaler 5y agoIf it's pure Javascript and canvas (2D or WebGL) and no HTML/CSS (often the first thing you'll reach for when drawing and styling text) then it's pretty straightforward to render to JPG/PNG using node-canvas. WebGL on the server is a bit more cumbersome with setting up an X virtual frame buffer (xvfb). SVG is a lot more finicky, but I've used React to generate SVG that imagemagick can then rasterize. If you limit yourself to primitives, you can have an interactive React UI and be able to render any state snapshot to .svg, .jpg, and/or .png. I think things just get tricky if you want to use a browser-only library or something that mixes canvas, svg, and/or html+css.