Kind: global class
Api: public
- SvgSaver
- new SvgSaver()
- .cloneSVG(el) ⇒
SVGElement
- .getHTML(el) ⇒
String
- .getBlob(el) ⇒
Blog
- .getUri(el) ⇒
String
- .asSvg(el, [filename]) ⇒
SvgSaver
- .getPngUri(el, cb)
- .asPng(el, [filename]) ⇒
SvgSaver
SvgSaver constructor.
Example
var svgsaver = new SvgSaver(); // creates a new instance
var svg = document.querySelector('#mysvg'); // find the SVG element
svgsaver.asSvg(svg); // save as SVG
Return the cloned SVG after cleaning
Kind: instance method of SvgSaver
Returns: SVGElement
- SVG text after cleaning
Api: public
Param | Type | Description |
---|---|---|
el | SVGElement |
The element to copy. |
Return the SVG HTML text after cleaning
Kind: instance method of SvgSaver
Returns: String
- SVG text after cleaning
Api: public
Param | Type | Description |
---|---|---|
el | SVGElement |
The element to copy. |
Return the SVG, after cleaning, as a text/xml Blob
Kind: instance method of SvgSaver
Returns: Blog
- SVG as a text/xml Blob
Api: public
Param | Type | Description |
---|---|---|
el | SVGElement |
The element to copy. |
Return the SVG, after cleaning, as a image/svg+xml;base64 URI encoded string
Kind: instance method of SvgSaver
Returns: String
- SVG as image/svg+xml;base64 URI encoded string
Api: public
Param | Type | Description |
---|---|---|
el | SVGElement |
The element to copy. |
svgSaver.asSvg(el, [filename]) ⇒ SvgSaver
Saves the SVG as a SVG file using method compatible with the browser
Kind: instance method of SvgSaver
Returns: SvgSaver
- The SvgSaver instance
Api: public
Param | Type | Description |
---|---|---|
el | SVGElement |
The element to copy. |
[filename] | string |
The filename to save, defaults to the SVG title or 'untitled.svg' |
Gets the SVG as a PNG data URI.
Kind: instance method of SvgSaver
Api: public
Param | Type | Description |
---|---|---|
el | SVGElement |
The element to copy. |
cb | function |
Call back called with the PNG data uri. |
svgSaver.asPng(el, [filename]) ⇒ SvgSaver
Saves the SVG as a PNG file using method compatible with the browser
Kind: instance method of SvgSaver
Returns: SvgSaver
- The SvgSaver instance
Api: public
Param | Type | Description |
---|---|---|
el | SVGElement |
The element to copy. |
[filename] | string |
The filename to save, defaults to the SVG title or 'untitled.png' |