3

I'm currently trying to generate pdf from an html page with charts generated by raphael.

It works great on every browser except internet explorer < 9 for which raphael use vml.

I'm using wkhtmltopdf to convert the page, it's using webkit to render the page so it doesn't support vml when IE is used.

Is there a way to force Raphael to render svg instead of vml in IE? I know it won't display, but what I would do is render it once in vml and a second time in svg.

I've seen that I can set the property

Raphael.type = "SVG";
Raphael.svg = true; 

but it doesn't work after the object has been instantiated.

Moop
  • 93
  • 1
  • 1
  • 4

3 Answers3

2

I too am one of those people that want Internet Explorer to generate an SVG. It doesn't have to be displayed, just sent to the server. So I looked into this:

You can force Raphael into thinking it should generate an SVG doing so:

    var rProto, paper;

    rProto = Raphael.prototype.raphael;
    rProto.svg = true;
    rProto.vml = false;
    rProto.type = 'SVG';

    var paper = Raphael(...);

However, Raphael will now throws tons of errors, because Internet Explorer will follow the codepath of modern browsers, which will obviously not work. I looked at those errors and they don't seem trivial to fix or work around.

Blaise
  • 13,139
  • 9
  • 69
  • 97
0

A lot of the commands reference R.vml try setting that as well,

Raphael.vml = false;
Andrew
  • 13,757
  • 13
  • 66
  • 84
  • Sadly this does not work. Once the object is instantiated it seems nothing can make it change. – Moop Aug 29 '11 at 13:52
0

According to this thread (a bit old though) there is no way to make IE accept SVG elements:

http://groups.google.com/group/raphaeljs/browse_thread/thread/5a05193c0334bda7/25776b86e78d3c2f?lnk=gst&q=force+svg#25776b86e78d3c2f

However, I don't understand what you mean with "it's using webkit so it doesn't support VML when IE is used". As far as I know, WebKit is a different renderer and it is in no way related to IE. Perhaps if you develop a bit further in your issue, we can help finding a solution.

jjmontes
  • 24,679
  • 4
  • 39
  • 51