Importing SVG into VG.net

Code samples and article discussion

Moderators: Frank Hileman, Anne Szyjan

Post Reply
User avatar
Frank Hileman
Site Admin
Posts: 1400
Joined: Sun Jul 25, 2004 8:16 pm
Location: California
Contact:

Importing SVG into VG.net

Post by Frank Hileman » Fri Sep 23, 2005 8:40 am

Image

If you need to import SVG into VG.net, this converter allows you to drag an svg file from the file explorer and drop it onto a VG.net Picture. If the SVG files is simple enough, it will be converted into VG.net elements and added to your Picture.

The binary installers are for full versions of VG.net, not evaluation or Lite versions:

VG.net SVG Importer for version 5.3.9912 (Visual Studio 2008)
VG.net SVG Importer for version 6.3.9915 (Visual Studio 2010)

Illustrator has an export option that will eliminate adobe-specific svg extensions. Be sure to use this option, and delete the namespace section.

There are many things still to do with the importer:
  • More stroke properties
  • Radial gradients
  • Text
  • Other things...
It works with simple SVG files. If nothing shows up when you drop a file, most likely an exception was thrown. If you want to debug the problem or make enhancements to the importer, the source code is here:

VG.net SVG Importer Source Code (Visual Studio 2005)
VG.net SVG Importer Source Code (Visual Studio 2008)
VG.net SVG Importer Source Code (Visual Studio 2010)

The source code includes a test application you can use to debug the importer.

It would probably take at least 1 week of work to get good SVG support, for the things that are equivalent in VG.net. If you need better support for something specific, please ask us about consulting.

Note: The binaries and source code in the links above are provided AS IS with no warranties whatsoever.
Note: For VG.net versions 4.1a and 5.1a (intial release), the Visual Studio integration for the SVG plug-in was broken. These problems were fixed in subsequent releases.

Thanks again to Arron Washington for his help.
Last edited by Frank Hileman on Wed Jul 30, 2008 4:05 pm, edited 5 times in total.

User avatar
Frank Hileman
Site Admin
Posts: 1400
Joined: Sun Jul 25, 2004 8:16 pm
Location: California
Contact:

Building Custom Importers in General

Post by Frank Hileman » Tue Apr 04, 2006 10:17 am

VG.net has a PictureImporter base class for building custom importers. Using the following sample source code, you can build and importer and installer that will enable your importer to function as a plug-in in Visual Studio. In this way you can drag and drop or copy and paste a file into a VG.net Picture within the designer. This is how the SVG importer is implemented.

Use these links to download the sample projects:

TestImporter sample for Visual Studio 2003

TestImporter sample for Visual Studio 2005

By the way, a third party developer has created an excellent wmf/emf commercial importer. If you are interested I will put you in contact with the developer.

Happy importing! :)

Post Reply