Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic SVG exporter issue (Read 746 times)
nullable
Junior Member
**
Offline


I Love MindFusion!

Posts: 86
Joined: Aug 25th, 2022
SVG exporter issue
Nov 25th, 2022 at 4:58am
Print Post  
Hello, I have a problem with the svg exporter, for some reason the lines of the exported diagram are thicker than originally, could you check this?

For example, I have the following code with a custom node that draws a rectangle with an ellipse and exports the resulting diagram to SVG, then loads it into a node, changes the position so that the original node overlaps the node with SVG content, but the SVG content node is still visible because its lines are thickener.

Code
Select All
var rectangle = new RectangleNode();
rectangle.Bounds = new Rect(0, 0, 300, 100);
Diagram.Items.Add(rectangle);

var svgExporter = new SvgExporter();
svgExporter.Export(Diagram, pathToTempSvg);
var diagramContent = new SvgNode();
diagramContent.Bounds = new Rect(100, 100, 300, 100);
diagramContent.Transparent = true;
diagramContent.ContentAlign = ImageAlign.Stretch;
diagramContent.ContentAutoBounds = true;
diagramContent.SvgUrl = pathToTempSvg;
Diagram.Items.Add(diagramContent);

rectangle.PenBrush = Brushes.Red;
rectangle.ZIndex = diagramContent.ZIndex + 1;
rectangle.Bounds = rectangle.Bounds with { X = 100, Y = 100 };
rectangle.InvalidateVisual();

var rectangle2 = new RectangleNode();
rectangle2.PenBrush = Brushes.Green;
rectangle2.Bounds = new Rect(100, 250, 300, 100);
Diagram.Items.Add(rectangle2);

var rectangle3 = new RectangleNode();
rectangle3.PenBrush = Brushes.Blue;
rectangle3.Bounds = new Rect(100, 250, 300, 100);
Diagram.Items.Add(rectangle3);
 



Code
Select All
public class RectangleNode : SvgNode
{
        public Brush PenBrush { get; set; } = Brushes.Black;

        public override void Draw(DrawingContext graphics, RenderOptions options)
        {
            graphics.DrawRectangle(Brushes.Transparent, new Pen(PenBrush, 1), Bounds with { X = 0, Y = 0});
            graphics.DrawEllipse(Brushes.Transparent, new Pen(PenBrush, 5), new Point(Bounds.Width / 2, Bounds.Height / 2), 10, 10);
        }
}
 


  

index.PNG ( 4 KB | 38 Downloads )
index.PNG
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3154
Joined: Oct 19th, 2005
Re: SVG exporter issue
Reply #1 - Nov 28th, 2022 at 10:11am
Print Post  
Hi,

It should be more precise with new build here -
https://mindfusion.eu/_beta/wpfdiag39.zip

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint