SvgSaver
Constructor Summary
Public Constructor | ||
public |
constructor(opts: *) SvgSaver constructor. |
Method Summary
Public Methods | ||
public |
Saves the SVG as a PNG file using method compatible with the browser |
|
public |
Saves the SVG as a SVG file using method compatible with the browser |
|
public |
getBlob(el: SVGElement): Blog Return the SVG, after cleaning, as a text/xml Blob |
|
public |
Return the SVG HTML text after cleaning |
|
public |
Return the SVG, after cleaning, as a image/svg+xml;base64 URI encoded string |
Public Constructors
public constructor(opts: *) source
SvgSaver constructor.
Params:
Name | Type | Attribute | Description |
opts | * |
Example:
var svgsaver = new SvgSaver(); // creates a new instance
var svg = document.querySelector('#mysvg'); // find the SVG element
svgsaver.asSvg(svg); // save as SVG
Public Methods
public asPng(el: SVGElement, filename: string): SvgSaver source
Saves the SVG as a PNG file using method compatible with the browser
Params:
Name | Type | Attribute | Description |
el | SVGElement | The element to copy. |
|
filename | string |
|
The filename to save, defaults to the SVG title or 'untitled.png' |
public asSvg(el: SVGElement, filename: string): SvgSaver source
Saves the SVG as a SVG file using method compatible with the browser
Params:
Name | Type | Attribute | Description |
el | SVGElement | The element to copy. |
|
filename | string |
|
The filename to save, defaults to the SVG title or 'untitled.svg' |
public getBlob(el: SVGElement): Blog source
Return the SVG, after cleaning, as a text/xml Blob
Params:
Name | Type | Attribute | Description |
el | SVGElement | The element to copy. |
Return:
Blog | SVG as a text/xml Blob |