This project has moved and is read-only. For the latest updates, please go here.

Getting Document extents

Topics: Converters and Runtime, SVG
Jun 17, 2016 at 4:28 PM
I'm using SharpVectors to dynamically convert an svg file to a Drawing which I then display in my GUI. I'm using the following code
public static DrawingBrush CreateBrush(Stream stream)
    {
      try
      {
        MemoryStream dummy = new MemoryStream();
        var a = new SharpVectors.Converters.StreamSvgConverter(true, false, new SharpVectors.Renderers.Wpf.WpfDrawingSettings());
        a.Convert(stream, dummy);
        var b = new DrawingBrush(a.Drawing);
        b.Freeze();
        return b;
      }
      catch (Exception)
      {
      }
      return null;
    }
This works but the extents of the drawing only take into account the extents of all of the graphic elements. I'd like to have the brush use the extents of the svg document so if the svg document is a page with just a small graphic in the center that same spacing is preserved in my conversion. The Bounds of the drawing do the have the correct offset but I can't figure out how to get the correct extents of the document.

Also, is the above code the best way to convert an svg file to a Drawing? It seems excessive since I don't really care about the xaml output and just throw it away.
Coordinator
Oct 17, 2016 at 7:16 PM
Hello,

This is a pending issue #1957 and I am looking into it.

Best regards,
Paul.