New version of Ab2d.ReaderSvg and ViewerSvg

by abenedik 20. August 2010 17:55

The best svg reader for WPF and svg to xaml converter for WPF and Silverlight is now even better.

This release focuses mostly on making work with Ab2d.ReaderSvg easier. Now it is possible to get progress report when reading svg files (there are also two interesting samples about this). It is now easier to use GetXaml method when the read svg file has embedded images. Also the ResourceDictionaryWriter class (helper class to create ResourceDictionaries from svg files) is now greatly improved. With new protected fields and protected virtual methods it is now very customizable.

The reading engine also has some improvements. It fixes some of the special issues that were reported by error reporting in ViewerSvg. The number or error reports is now very low and this tells that the reading engine is already very good and can handle really most of svg files.

The problems with showing the exported xaml in Visual Studio 2010 designer for Silverlight are now gone. With the new version the GetXaml method sets Width and Height to Path element when it is called to create xaml for Silverlight. This is a workaround for a bug in Visual Studio - please vote for the bug on Microsoft Connect so it will be fixed as soon as possible.

The samples have also been updated. There are now a few more samples and they are now available for both Visual Studio 2008 and 2010.

The following is a list of all changes in Ab2d.ReaderSvg:

  • Added ProgressChanged event to ReaderSvg to get report progress when reading file.
  • Improved GetXaml method for Silverlight: Added workaround for displaying Paths in Silverlight in Visual Studio 2010 designer - set Width and Height to Path element.
  • Improved GetXaml method - now the images are written to xaml without need to specify ResolveImagePath delegate. The uri format can be specified with the new DefaultImageUriFormatString property in XamlWritterSettings.
  • Improved reading linked images (not embedded into svg file). Before an exception was thrown when the image file could not be located - now the image object is created but its Source is not set.
  • Fixed reading some svg files with embedded image that reported "Invalid length for a Base-64 char array." error (used custom base64 reader instead of .Net method to read the string).
  • Fixed problems with reading svg files from Microsoft Visio that have more than one layer with the same name defined.
  • Improved ResourceDictionaryWriter class to make it much more customizable. The AddFile and AddStream methods now work correctly. The usedSvgReader, geometrySettings and xamlWritterSettings fields are now protected so they can be changed in derived class. Also the methods CreateReaderSvg, CreateXamlWriterSettings, ReadSvgFile, ReadSvgStream, GetXaml, GetRootResourceKey and ResolveResourceKeyCallback are now protected and virtual so they can be overriden in derived class.
  • Added AddHiddenElements property that specifies if hidden elements are read. If the value of AddHiddenElements is true, than hidden elements are read and have their Visibility property set to Hidden or Collapsed (depends on using display or visibility attribute in svg file).

 

 

As always the ViewerSvg application has also been improved.

As with Paste2Xaml the ViewerSvg can now also change the size of read elements to any custom size. This is not done with only adding a ScaleTransform to the root element (as in previous versions) but now the positions, sizes and other values are changed to fit into the new size.

The improvements in Ab2d.ReaderSvg are also reflected in ViewerSvg. There is now an option to read or skip reading hidden elements. The export dialog also has some new settings - see the following is a screenshot:

ViewerSvg export dialog

 

As usual the new version can be downloaded from User Account page (for commercial users) or from my Downloads page (for evaluation version).

Tags: , , ,

ReaderSvg