I'm using SVG.js to draw shapes. I want to save the drawing as an image(.png). Any suggestions to do this?
Asked
Active
Viewed 118 times
2
-
take a look [here](https://stackoverflow.com/help/minimal-reproducible-example), your question doesn't provide any code or what have you tried – Maifee Ul Asad Oct 30 '19 at 06:28
-
2You can use this: https://github.com/sampumon/SVG.toDataURL Convert SVG to Canvas and save the image from canvas. You should be able to do this in 10-20 lines of code – dotnetCarpenter Oct 30 '19 at 20:05
-
did you find a solution? – Bejuco Mar 29 '20 at 22:35
-
1yeah. I used "save-svg-as-png" library like following, saveSvgAsPng(document.querySelector('.svg_container'), 'diagram.png'); where svg_container is the class name of svg element and diagram.png is the name of the file to be saved – Sharmi Mar 30 '20 at 09:49