Interface: CustomHandler

CustomHandler

All methods are optional.

Source:

Methods

exportImage(win, data) → {void}

Its responsibilities (with regard to the object it is supplied in its 2nd argument) are:

  • inform user of any issues supplied via the "issues" property
  • convert the "svg" property SVG string into an image for export; utilize the properties "type" (currently 'PNG', 'JPEG', 'BMP', 'WEBP', 'PDF'), "mimeType", and "quality" (for 'JPEG' and 'WEBP' types) to determine the proper output.
Parameters:
Name Type Description
win external:Window
data module:svgcanvas.SvgCanvas#event:exported
Source:
Listens to Events:
  • module:svgcanvas.SvgCanvas#event:exported
Returns:
Type
void

exportPDF(win, data) → {void}

Parameters:
Name Type Description
win external:Window
data module:svgcanvas.SvgCanvas#event:exportedPDF
Source:
Listens to Events:
  • module:svgcanvas.SvgCanvas#event:exportedPDF
Returns:
Type
void

open() → {void}

Its responsibilities are:

  • invoke a file chooser dialog in 'open' mode
  • let user pick a SVG file
  • calls svgCanvas.setSvgString() with the string contents of that file. Not passed any parameters.
Source:
Returns:
Type
void

save(win, svgStr) → {void}

Its responsibilities are:

  • accept the string contents of the current document
  • invoke a file chooser dialog in 'save' mode
  • save the file to location chosen by the user.
Parameters:
Name Type Description
win external:Window
svgStr module:svgcanvas.SvgCanvas#event:saved

A string of the SVG

Source:
Listens to Events:
  • module:svgcanvas.SvgCanvas#event:saved
Returns:
Type
void