SVGToImage

SVGToImage

Used for downloading an SVG DOM element in your browser

Constructor

new SVGToImage()

Source:

Methods

_inlineImages(callback)

Inlines all images
Source:
Parameters:
Name Type Description
callback function The callback to run after images have been loaded and inlined

_isExternal(url) → {boolean}

Verifies if the supplied URL is external or local
Source:
Parameters:
Name Type Description
url string The URL to check
Returns:
Type:
boolean
True if the supplied URL is external

_isValidElement(element) → {boolean}

Validates the provided element is an HTMLElement Source: http://stackoverflow.com/a/384380/3886818
Source:
Parameters:
Name Type Description
element mixed The element to validate
Returns:
Type:
boolean
True if the provided element is valid

_toDataURI(options, callback)

Converts the element to a data URI
Source:
Parameters:
Name Type Description
options object Configuration options
callback function The callback to run after the element has been converted

download(name, options)

Downloads the SVG as an image
Source:
Parameters:
Name Type Description
name string The name to download the image with
options object The configurable options

SVGToImage

new SVGToImage(element)

Constructor takes in the element for later use
Source:
Parameters:
Name Type Description
element object The SVG element to convert to an image

Methods

_inlineImages(callback)

Inlines all images
Source:
Parameters:
Name Type Description
callback function The callback to run after images have been loaded and inlined

_isExternal(url) → {boolean}

Verifies if the supplied URL is external or local
Source:
Parameters:
Name Type Description
url string The URL to check
Returns:
Type:
boolean
True if the supplied URL is external

_isValidElement(element) → {boolean}

Validates the provided element is an HTMLElement Source: http://stackoverflow.com/a/384380/3886818
Source:
Parameters:
Name Type Description
element mixed The element to validate
Returns:
Type:
boolean
True if the provided element is valid

_toDataURI(options, callback)

Converts the element to a data URI
Source:
Parameters:
Name Type Description
options object Configuration options
callback function The callback to run after the element has been converted

download(name, options)

Downloads the SVG as an image
Source:
Parameters:
Name Type Description
name string The name to download the image with
options object The configurable options