SVGRenderer

Renders an external SVG file into a Graphic.

const svgRenderer = getSVGFromURL(svg);
if (!svgRenderer) return [];
return svgRenderer.render();

Methods

.render()(Graphic | undefined)

Parses the SVG into a Graphic, scaled to project units with the top-left of the SVG view box at the origin. Returns undefined if the SVG can't be parsed.

.viewBox()(BoundingBox | undefined)

The view box of the SVG as a BoundingBox in project units with the top-left of the view box at the origin. Returns undefined if the SVG has no view box, or if its view box is malformed.