Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVG to VML - how?

Tags:

vector

svg

vml

I have an SVG file, which I would like to view in Internet Explorer.

IE uses VML for vector-files, but I can't find ANY kind of converter between those two formats anywhere! (not in Inkscape, Illustrator, OpenOffice Draw.....how is this possible !)

I took a look at Raphael, but Raphael can't read existing files.

I found http://vectorconverter.sourceforge.net/index.html

but I can't understand how to use it... any help ?

like image 591
Dylan Avatar asked Oct 10 '22 17:10

Dylan


2 Answers

Try this - SVG path to VML Path. It basically transforms SVG path into VML path that can be used in v:shape.However you still have to transform SVG's path into v:shape manually. The vector converter that you have tried is web based and uses XSLT templates to do the transformation, while the library that i'm suggesting can do it with pure javascript and single line of code. Hope this helps.

like image 77
Angel Kostadinov Avatar answered Nov 08 '22 22:11

Angel Kostadinov


You can try this online converter : http://www.irunmywebsite.com/raphael/SVGTOHTML_LIVE.php

You can choose between shapes converted as JSON which are managed by Raphael. Or an inline and faster wrapping with Raphael.

I personally prefer the JSON method. You can put the content on an external file and ajax drawings at will. You will next draw the shapes with either of the following methods :

    Raphael(json);  //create a new paper with the shapes

Or if you want to draw on an existing paper :

    function drawJson(items, paper) {
        var set = paper.set(),
            l = items.length;

        for (i = 0; i < l; i++) {
            set.push(paper[items[i].type]().attr(items[i]));
        }

        return set;
    }

You can put the last function in a Raphael plugin.

Note : You can save some kb by removing some spaces inside the converted paths. For example with ant :

<replaceregexp match="\s?([CML])\s?" replace="\1" flags="g" file="drawings.json"/>
like image 43
Placoplatr Avatar answered Nov 08 '22 20:11

Placoplatr