Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Problems with exporting diagram to PDF (Read 52 times)
MikeB
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 1
Joined: Apr 24th, 2024
Problems with exporting diagram to PDF
Apr 24th, 2024 at 1:06pm
Print Post  
Hi,

I'm trying to export simple diagram to PDF and i've got a different view in a file rather than in a control. One of the edges of the rectangle shape is missing. Morover the trial header is clipped. Whats wrong ? Is it regular behavior ?

Code
Select All
public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            var shapeNode = new ShapeNode()
            {
                Shape = new Shape(new ElementTemplate[]
                {
                    new LineTemplate(0, 0, 100, 0),
                    new LineTemplate(100, 0, 100, 100),
                    new LineTemplate(100, 100, 0, 100),
                }, FillRule.EvenOdd)
            };

            diagram.Nodes.Add(shapeNode);
            diagram.Nodes.First().Move(50, 50);
        }

        private void diagram_DoubleClicked(object sender, DiagramEventArgs e)
        {
            PdfExporter pdfExp = new PdfExporter();
            pdfExp.Export(diagram, @"D:\temp\diagram.pdf");
        }
    }
 

  

diagram.pdf ( 3 KB | 5 Downloads )
diagram.jpg ( 21 KB | 1 Download )
diagram.jpg
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3156
Joined: Oct 19th, 2005
Re: Problems with exporting diagram to PDF
Reply #1 - Apr 24th, 2024 at 2:33pm
Print Post  
Hi,

Apparently our WPF rendering code auto-closes the shape with missing left side, but PDF one does not. Add an explicit left line -

Code
Select All
Shape = new Shape(new ElementTemplate[]
{
    new LineTemplate(0, 0, 100, 0),
    new LineTemplate(100, 0, 100, 100),
    new LineTemplate(100, 100, 0, 100),
    new LineTemplate(0, 100, 0, 0)
}, FillRule.EvenOdd) 



or just use standard rectangle -

Code
Select All
var shapeNode = new ShapeNode()
{
    Shape = Shapes.Rectangle
}; 



and it should render as expected.

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