Kind: global class
Api: public
- SvgSaver
- new SvgSaver()
- .getHTML(el) ⇒
String - .getBlob(el) ⇒
Blog - .getUri(el) ⇒
String - .asSvg(el, [filename]) ⇒
SvgSaver - .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 SVGReturn 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' |
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' |