Drawing SVG in .NET / C #?

I would like to generate an SVG file using C #. I already have code for drawing them in PNG and EMF formats (using the standard framework class System.Drawing.Imaging.Metafile and ZedGraph ). What can you recommend to adapt this code to SVG? I would like to find some library (free or not) that would mimic the System.Drawing.Graphics interface.

+64
c # vector-graphics svg
Oct 06 '09 at 12:57
source share
5 answers

View the SVG structure in a C # project and SVG-GDI + .

From the above web page ...

The SvgGdi bridge is a collection of classes that use SvgNet to translate between SVG and GDI +. This means that any code that uses GDI + to draw graphs can easily output SVGs as well, just by plugging in an SvgGraphics Object. This object is just like regular .NET. A graphic, but creates an SVG tree. Even things like flooded fill and linear anchors are implemented.

+38
Oct 06 '09 at 13:01
source share

We made a public branch of the C # .NET SVG library on github.

It is significantly improved compared to what you find in codeplex, please look and open it the way you like:

https://github.com/vvvv/SVG

Edit: just to let you know, as of June 2019:

While others seem dead over the years, it is still active. But we could definitely use some help from other developers.

+21
Jun 04 '13 at 20:35
source share
+7
Oct 06 '09 at 13:02
source share

I used this http://svg.codeplex.com/ and I am quite happy with that. There are still some errors, so you should take a look at the patches at http://svg.codeplex.com/SourceControl/PatchList.aspx .

When I discover errors, I can decide, I post them right there. But the guys need some time to be appreciated. It is a better idea to take a look at the patches and apply them yourself.

The library is sufficient enough for most common needs. for really bizarre things, you need to improve thinking ...

+7
Oct 20 '09 at 14:31
source share

Since SVG is basically an XML document, you can implement the drawing yourself. Check the specifications of the W3C SVG specification . I did this once in order to create SVG signature images, all it took was a couple of hours and firefox to check the generated image.

Of course, this applies if you are generating an image from user input, or if you do not mind spending some time converting from another vector image format.

PS you can create your own wrapper to simulate System.Drawing.Graphics, for example. DrawLine () to add to the internal buffer, etc.

+3
Oct 06 '09 at 13:19
source share



All Articles