canvg not working with IE 10

2.9k views Asked by At

I am working on converting svg to png. For this conversion I am using canvg. This conversion is working fine with google chrome but IE 10 gives the following error message.

Unhandled exception at line 137, column 5 in http://localhost:21683/Js/canvg.js

0x800a139e - JavaScript runtime error: SyntaxError

I tried the following codes

http://jsfiddle.net/dGzau/

http://jsfiddle.net/fnyJV/

How to make it to run on IE 10?

Could anyone please help me to do this?

1

There are 1 answers

0
Axeln5 On BEST ANSWER

I found this improvement (http://code.google.com/p/canvg/issues/detail?id=189) and works fine on IE10. But I'm searching a solution for Internet Explorer under 10.

If I add the following lines at the beginning of the 'svg.parseXml' function my code now works.

// -- Internet Explorer trick, otherwise an error is generated in the 'parseFromString' function when 
// -- You use <svg xmlns="http://www.w3.org/2000/svg"></svg> declarations, this is the case for Raphael
xml = xml.replace(/xmlns=\"http:\/\/www\.w3\.org\/2000\/svg\"/, '');