Save SVG element with custom font as an image

added by JavaScript Kicks
1/22/2019 9:25:45 AM

216 Views

It is easy to convert an SVG element into an image. Serialize the SVG element into a Base64 string and set the image src attribute. const serializer = new XMLSerializer(); const svgString = serializer.serializeToString(svgElem); const img = new Image(); img.src = 'data:image/svg+xml;base64,' + Base64.encode(svgString); It is easy to save the image to a file.


0 comments