I'm using a plugin (dom-to-image) to generate a SVG content from a div. It returns me a dataURL like this:
data image/xml, charset utf-8, <svg...
If a put this on a <img src
the image is shown to normally.
The intent is to grab this dataURL, convert it to base64 so I can save it as an image.png on a mobile app.
Is it possible?
I tryied this solution https://stackoverflow.com/a/28450879/1691609 But coudn't get to work. The console fire an error about the dataUrl
TypeError: Failed to execute 'serializeToString' on 'XMLSerializer': parameter 1 is not of type 'Node'.
==== UPDATE :: PROBLEM EXPLANATION/HISTORY ====
I'm using Ionic Framework, so my project is an mobile app. The dom-to-image is already working cause right now, its rendering a PNG through toPng function. The problem is the raster PNG is a blurry.
So I thought: Maybe the SVG will have better quality. And it IS!! Its 100% perfect, actually.
On Ionic, I'm using 2 step procedure to save the image. After get the PNG generated by the dom-to-img(base64) dataURL, I convert it to a Blob and then save into device. This is working, but the final result, as I said, is blurry.
Then with SVG maybe it will be more "high quality" per say.
So, in order to do "minimal" change on a process that s already working :D I just need to convert an SVG into base64 dataURL....
Or, as some of you explained to me, into something else, like canvas... I don't know any much :/
===
Sorry for the long post, and I really, really thank your help guys!!