Articles in this section
Category / Section

How to view exported PDF document in WPF SfDataGrid?

2 mins read

You can export the WPF DataGrid into Pdf and the exported Pdf document can be viewed in application itself by using Syncfusion PdfViewerControl.

You can export the SfDataGrid into Pdf by using SfDataGrid.ExportToPdf extension method available in Syncfusion.UI.Xaml.Grid.Converter namespace.  The exported document can be loaded into PdfViewerControl using PdfViewerControl.Load method as illustrated in the following code example.

C#

private void exportPdfViewer_Click(object sender, RoutedEventArgs e)
{
    var document= this.sfdatagrid.ExportToPdf();
    MemoryStream stream = new MemoryStream();
    document.Save(stream);
    PdfViewerControl pdfViewer1 = new PdfViewerControl();
    pdfViewer1.Load(stream);
    Window window = new Window();
    window.Content = pdfViewer1;
    window.Show();
}

 

You can refer to the sample from the following location.

WPF: ExportGridToPdfDocumenViewer_WPF

Conclusion

I hope you enjoyed learning about how to view exported PDF document in SfDataGrid using Syncfusion PDF viewer.

You can refer to our WPF DataGrid feature tour page to know about its other groundbreaking feature representations. You can also explore our WPF DataGrid documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied