Is there any way to export as a SVG on Konva

Viewed 548


In my project I am using konvajs. Is there any way to export as a SVG image ?

2 Answers

Konva doesn't have an API to export a stage into SVG. The only way around is to make your own SVG-to-konva and konva-to-SVG converter.

You can generate an svg by using the canvas2svg package and tying it into the underlying canvas reference.

You can set your Layer's context equal to a c2s instance, rendering it, and resetting your Layer's ref to what it was previously, as shown here.

Related