Skip to content

Catdaemon/SVGtoPNG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

SVGtoPNG

Converts or downloads an SVG element as a PNG. I use this to save charts which have been generated with Vega and had their DOM messed with, which prevents the default exporter from working.

Usage

Trigger a PNG download

Simply provide an SVG element and a filename

SVGtoPNG.downloadPNG(document.querySelector("#headc svg"), "chart.png");

Get data-uri string

SVGtoPNG.toPNGString(document.querySelector("#headc svg"), function(data) { console.log(data); });

About

Converts or downloads an SVG as a PNG

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published