Simple way to render an SVG file?

Sep 26, 2008 at 6:49 PM
I can't seem to get this to work.  I'm using the following line to try to render an SVG file created in Inkscape.  I get a Jpeg file with the right dimensions, but no actual content.  Am I doing something wrong?

SvgDocument.Open(@"c:\temp\Test_1.svg").Draw().Save(@"c:\temp\Test_1.jpg", ImageFormat.Jpeg);

thanks,

Jim
Coordinator
Sep 27, 2008 at 4:55 AM
Jim,

That should be all you need to do. I haven't had any issues rendering simple images made with inkscape (with the latest source, not latest release) but maybe the file has some data that the project doesn't like. I can give it a test if you want to send me the test svg file?

Cheers,
Dave
Sep 27, 2008 at 11:12 PM
Dave,

Thanks for looking into this.  I created Issue # 7694 with the attached SVG file.

Jim
Oct 12, 2008 at 6:04 AM
Dave--Did you have any luck with the file?

thanks,

Jim
Oct 15, 2008 at 12:56 AM
I had a similar problem when using the dll assembly on the main page.  However the code worked when re-compiled from source.
Oct 15, 2008 at 4:55 PM
I downloaded the code and compiled from source, and it mostly worked.  My only problem is that I can't get an ellipse to render.  Everything else I've tried works great.  Any thoughts on that?

Thanks for the suggestion.
Coordinator
Oct 15, 2008 at 11:27 PM
Jim,

Sorry i haven't got back on this one - I've been on holiday 'til recently :)

I did look at your sample .svg file before I went away, but as you've already discovered the ellipse won't render. Inkscape (probably for very good reasons) renders ellipses using several Arc segments rather than a single <ellipse/> or <circle/> element and this project doesn't yet support Arc segments. There is a work item to support this though, - #6455 Arc Segments in SvgPathBuilder.

If you browse to that and 'Vote' to have the work item fixed it will at least bump it up the priority cue. I will try to get arcs implemented when I can get the time. Sorry 'bout these issues!

Cheers,
Dave
Oct 16, 2008 at 12:12 PM
Thanks, Dave.  I think this is a great project.

Jim
Coordinator
Oct 18, 2008 at 11:12 AM
Jim,

The latest source code (check-in 18243) has an arc implementation and I've tested your Test_2.svg file against this latest code and the rendered image appears identical to the one rendered  by Inkscape. Try this latest code out if you can and hopefully it will sort most of the issues you and others have been having with Inkscape ellipses :)

Cheers,
Dave
Nov 7, 2008 at 2:16 PM
Dave,

Yes, everything works great.  Thanks for adding that functionality.

Jim