We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to export the Diagram as a PDF in the WPF Diagram(SfDiagram)?

Platform: WPF |
Control: SfDiagram |
Published Date: February 27, 2018 |
Last Revised Date: April 21, 2020

SfDiagram does not have the built-in support to convert the diagram to PDF file, but it can be achieved by exporting the diagram as an XPS file and then, convert the exported XPS file to PDF using the Syncfusion.XPS.XPSToPdfConverter.

Exporting XPS

To export the diagram as an XPS file, enable the IsSaveToXps property of the ExportSettings class and specify the file name with the “.xps” extension.

Exporting XPS to PDF

The XPS document can be converted into PDF file using the XPSToPdfConverter class of PDF library.



            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="100"/>
     <syncfusion:SfDiagram x:Name="diagram"  Grid.Column="0">
                    <syncfusion:NodeViewModel OffsetX="100" OffsetY="100" 
                                UnitHeight="100" UnitWidth="100"/>
                    <syncfusion:ConnectorViewModel SourcePoint="100,100" TargetPoint="200,200" />
    <Button x:Name="Export" Grid.Column="1" Click="Export _Click" Content="Export"/>



private void Export _Click(object sender, RoutedEventArgs e)
            diagram.ExportSettings = new ExportSettings()
                  IsSaveToXps = true,
                  FileName = "export.xps",
            (diagram.Info as IGraphInfo).Export();
            var converter = new XPSToPdfConverter { };
            var document = new PdfDocument();
            document = converter.Convert("export.xps");


View Sample in GitHub

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon