Home Identifier Source Test Repository

svgsaver

download an svg element as an SVG or PNG file, including CSS defined styles.

Features

Usage

For maximum compatibility across browsers include eligrey/FileSaver.js/ and eligrey/canvas-toBlob.js.

Example

var SvgSaver = require('svgsaver');                 // if using CommonJS environment
var svgsaver = new SvgSaver();                      // creates a new instance
var svg = document.querySelector('#mysvg');         // find the SVG element
svgsaver.asSvg(svg);                                // save as SVG

Demos

Acknowledgments

Based on previous work on Hypercubed/angular-downloadsvg-directive. Some portions of this code inspired by raw and moagrius/copycss.

License

MIT License