This sample shows how to use Diagram.makeSvg function to render all or part of a diagram and to initiate a file download.


GoJS Features in this sample

Exporting SVGs

GoJS has one function for creating SVG: Diagram.makeSVG, which returns a new SVGElement with a representation of a GoJS Diagram. The method has a single argument, a JavaScript Object that contains several definable properties, enumerated in the documentation. More information can be found in the GoJS Intro.

Related samples


Exporting Raster Images

GoJS has two functions for creating raster images: Diagram.makeImageData, which outputs a Base64 image data string, and Diagram.makeImage, which is a convenience function that calls Diagram.makeImageData and returns a new HTMLImageElement with the image data as its source. Both functions have the same single argument, a JavaScript Object that contains several definable properties, enumerated in the documentation. More information can be found in the GoJS Intro.

Related samples