0

I have a very similar problem as this post; I'm using RaphaelJS to generate a chart, but more specifically in my case I need to print the result. I have used Inkscape's command line utility (it's excellent) to convert Raphael's SVG output to a PNG file, which the user can download and print.

The problem is, it works in Firefox etc. but not Internet Explorer. Because IE uses VML, not SVG, Inkscape won't convert it when the user is coming from IE.

I have had a look at IECapt which might well have done the job, but a literal screenshot wouldn't be enough in my scenario as the generated chart normally spans more than a screen width and I need it all in one file. Also the user can modify the chart by clicking on nodes etc without changing the URL, so actually using IECapt in my case would require URL parameters to replicate the state of the chart.

I just need to get my head around this conversion from the VML format and I can wipe my feet of this project!

Links

Community
  • 1
  • 1
Arj
  • 1,981
  • 4
  • 25
  • 45

1 Answers1

2

You can convert the VML to SVG via this: http://sourceforge.net/projects/vectorconverter/, taken from this question: Are there any tools to convert legacy VML to SVG?, then run it through Inkscape to get the PNG version.

Edit: The vectorconverter tool is PHP-based but uses XSLT for the heavy lifting - VML and SVG are just XML under the hood - so if you can't access the PHP libraries directly you could probably manage to reuse the XSLT in the language of your choice.

Community
  • 1
  • 1
peteorpeter
  • 4,037
  • 2
  • 29
  • 47
  • 1
    Thanks for this; I should have mentioned I've already seen that post and had a look at Vector Converter, but it seems as though only platforms which have PHP support can use VC? I'm working on a corporate intranet and which won't be able to support PHP. **Edit**: I've just seen your edit. I'll have a look if I can find anything on that. – Arj May 05 '11 at 13:07
  • 1
    I'm not a .NET guy, so I'm afraid I can't help there. Seems like it shouldn't be too hard to read into the XML enough to figure out whether you've got an SVG or a VML, then run the XSLT if it's VML before processing in inkscape. You could actually probably do the VML--> SVG translation on the client side (IE has a built-in XSLT engine) if you have the ability to write your own JS in this deployment environment, though I would recommend back-end processing if at all possible. – peteorpeter May 05 '11 at 13:19
  • Thanks for your help, I'm just doing some research on XSLT now. Do you think something like this would be along the right lines for doing this? http://www.w3schools.com/xsl/xsl_client.asp - (scroll to "Transforming XML to XHTML in the Browser"). I have access to the xslt file used by VectorConverter so it should just be a case of using the correct files? – Arj May 05 '11 at 14:04
  • 1
    That should work. You'd still need some logic to sniff for VML before routing it there, or just use conditional comments, I suppose. You could also look at http://johannburkard.de/software/xsltjs/ or http://www.jongma.org/webtools/jquery/xslt/. As a warning, client-side code like this can easily bottleneck in IE 6-7's aging JS engines (8's not too bad). If you can handle this server-side, you will likely avoid some headaches. – peteorpeter May 05 '11 at 14:23