I know it's possible to convert the whole cavas to SVG. But is it possible to convert separate objects like Path
, Line
, Rect
, etc. to SVG including all the styles that was applied to this objects?
Appreciate if someone can help.
Fabric.js objects have a method called toSVG()
for generating an SVG string. You can use it like this:
var obj = canvas.getActiveObject();
console.log(obj.toSVG());