Getting Started with WPF Pdf Viewer

This section demonstrates how to create an application that displays a PDF file using PDF viewer.

To get start quickly with WPF PDFViewer, you can check on this video:

Assemblies required

The following assemblies are required in your WPF application to use PDF viewer.

Required Assemblies Description
Syncfusion.Compression.Base This library handles various compression and decompression operations that are used in the PDF file internally.
Syncfusion.Pdf.Base This library contains the PDF reader and creator that supports the `PdfViewerControl`.
Syncfusion.PdfViewer.WPF This component contains the rendering area and other related UI elements.
Syncfusion.Shared.WPF This component provides various UI styles and themes used in the `PdfViewerControl`.


Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, you also have to include a license key in your projects. Please refer to this link to know about registering Syncfusion license key in your WPF application to use our components.

Create a simple PDF viewer application

Following steps demonstrates creating a simple PDF viewer application in WPF:

Drag the PdfViewerControl from toolbox

  1. After installing the Syncfusion Essential Studio in your machine, create a new WPF application in Visual Studio.
  2. Open the Visual Studio tool box. Navigate to “Syncfusion WPF Toolbox” tab and drag the PdfViewerControl toolbox item to the Designer window, it automatically adds the required references to the current application.

    Getting started

    PDF viewer control in toolbox

Creating PdfViewerControl from code

  1. To add the PdfViewerControl using code, add the required assemblies as reference to the project.
  2. Add the following Syncfusion namespace in XAML to make use of the PdfViewerControl.

         Title="MainWindow" Height="350" Width="525">
  3. Add the following code in XAML.

         <Syncfusion:PdfViewerControl Name="pdfViewerControl1"/>

Display PDF file

The PdfViewerControl’s ItemSource property allows you to bind PDF documents in XAML. This property accepts a stream input that can be bounded to the viewer during initialization. The following steps demonstrates how to display a PDF file using the PdfViewerControl:

  1. Create a simple class that loads a PDF document as illustrated in the following code example. Save the class file as PdfReport.cs.

         public class PdfReport : INotifyPropertyChanged
         private Stream docStream;
         public event PropertyChangedEventHandler PropertyChanged;
         public Stream DocumentStream
         return docStream;
         docStream = value;
         OnPropertyChanged(new PropertyChangedEventArgs("DocumentStream"));
         public PdfReport()
         //Load the stream from the local system.
         docStream = new FileStream("Barcode.pdf", FileMode.OpenOrCreate);           
         public void OnPropertyChanged(PropertyChangedEventArgs e)
         if (PropertyChanged != null)
         PropertyChanged(this, e);
  2. To bind the DocumentStream property of the PdfReport class, set the DataContext to the Window. To add the DataContext in XAML, use the following code example.

  3. After setting the DataContext, you can set the ItemSource dependency property of PdfViewerControl by using the following code example in XAML.

         <Syncfusion:PdfViewerControl ItemSource="{Binding DocumentStream}"/>


Alternatively, the Open button in the toolbar can also be used to load and display the PDF documents at runtime.