问题
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
- Using Inkscape directly from a C# application
- IECapt
回答1:
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.
来源:https://stackoverflow.com/questions/5898029/problems-converting-vml-to-svg-in-net