3

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?

Abinaya Selvaraju
  • 1,212
  • 1
  • 10
  • 16
  • You should mention your IE version while questioning. – Pandiyan Cool Aug 05 '13 at 07:33
  • Your fiddles seems to have a lot going on with jQuery and other stuffs. The answer here at http://stackoverflow.com/questions/18085854/print-large-raphael-js-chart-accross-multiple-pages has a fiddle http://jsfiddle.net/mdYnz/8/ that uses canvg without other libraries and depends on `innerHTML` and not on jQuery's `.html()`. Try this and check if it works. If yes, then I will delve into why your code is not working. – Shamasis Bhattacharya Aug 07 '13 at 19:15

1 Answers1

6

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\"/, '');
orique
  • 1,295
  • 1
  • 27
  • 36
Axeln5
  • 76
  • 1
  • 2