I want to save a generated SVG (by a javascript graphing library using d3) as a PNG or other image format.
I tried: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Drawing_DOM_objects_into_a_canvas
This does not render my SVG to a canvas. The example works but not with my SVG as it does not contain the <foreignObject>
directive.
Is there an other way to save the image that does not involve the server side?
Technical details:
- Project is in ReactJS
- I use the 'Recharts' library for charting although I consider switching to 'Victory'.