Is there any way to export as a SVG on Konva

1k views Asked by At


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

3

There are 3 answers

0
Mark Kompanets On BEST ANSWER

I have found library to do that, which is quite new. I did some tests, and it seems to work well.

This library for Konva React version.

npm install react-konva-to-svg

Links

https://www.npmjs.com/package/react-konva-to-svg

0
lavrton On

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.

0
Max Hudson On

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.