Skip to content

Latest commit

 

History

History
120 lines (87 loc) · 3.89 KB

API.md

File metadata and controls

120 lines (87 loc) · 3.89 KB

SvgSaver

Kind: global class
Api: public

new 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

svgSaver.cloneSVG(el) ⇒ SVGElement

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.

svgSaver.getHTML(el) ⇒ String

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.

svgSaver.getBlob(el) ⇒ Blog

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.

svgSaver.getUri(el) ⇒ String

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.getPngUri(el, cb)

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'