0

I have variable which contains a svg string which look like,

var svgEle = "<svg width="100" height="100">
<circle cx="50" cy="50" r="40" stroke="green" stroke-width="4"     fill="yellow" />
</svg>"

I want to convert this into .svg file object in JavaScript in order to pass that object to another method.

Is there a way of doing this

denny
  • 197
  • 1
  • 1
  • 11
  • @ Robert Longson, yes I may use DOM object as well – denny Sep 12 '16 at 13:14
  • @ Robert Longson, it create a document, but I need a file object – denny Sep 12 '16 at 13:35
  • @ Robert Longson yes, I said I can use DOM object to create the file object. But this method is returning a document not a file object which I am looking for. – denny Sep 12 '16 at 13:45
  • var file = new File([svg], fileName, {type: "image/svg+xml"}); It worked like this – denny Nov 09 '16 at 11:22

0 Answers0