jakubfiala / atrament

A small JS library for beautiful drawing and handwriting on the HTML Canvas.
http://fiala.space/atrament/demo
MIT License
1.56k stars 115 forks source link

Is there an option to save or convert the drawing in SVG format? #48

Closed bharatbondu closed 4 years ago

jakubfiala commented 4 years ago

Hey @bharatbondu - thanks for asking! SVG export isn't built in to the library, but you could implement it by recording the stroke data and generating SVG paths from it. Have a look at the Programmatic Drawing section of the readme - essentially instead of then calling atrament.draw, you could use the stroke data to build a SVG path string.

N.B. SVG paths have uniform stroke thickness, so you'd have to find a way to render the variable thickness as well.

Please do let me know if you implement such a thing, I'd happily link to your code as a solution for future users :)