New to Telerik UI for WinForms? Download free 30-day trial

Getting Started with WinForms PdfViewer

This tutorial will help you to quickly get started using the control.

RELATED VIDEOS
Getting Started with the WinForms RadPdfViewer
RadPdfViewer enables you to easily load and display PDF documents natively in your app without using any third-party tools except Telerik’s WinForms toolbox. Thanks to its built-in UI virtualization, RadPdfViewer delivers a performant solution in every scenario. This component will come as a nice addition to your Content Management Systems and Reporting applications, let’s see what RadPdfViewer provides as a feature set.
WinForms RadPdfViewer Tutorial

Adding Telerik Assemblies Using NuGet

To use RadPdfViewer when working with NuGet packages, install the Telerik.UI.for.WinForms.AllControls package. The package target framework version may vary.

If you don’t need all controls, you can instead install a more lightweight package targeting only RadPdfViewer: UI.for.WinForms.PdfViewer. This package has a dependency on UI.for.WinForms.Common, Telerik.Windows.Documents.Core, and Telerik.Windows.Documents.Fixed, that will be automatically installed when adding the PdfViewer NuGet.

Read more about NuGet installation in the Install using NuGet Packages article.

With the 2025 Q1 release, the Telerik UI for WinForms has a new licensing mechanism. You can learn more about it here.

Adding Assembly References Manually

When dragging and dropping a control from the Visual Studio (VS) Toolbox onto the Form Designer, VS automatically adds the necessary assemblies. However, if you're adding the control programmatically, you'll need to manually reference the following assemblies:

  • Telerik.Licensing.Runtime
  • Telerik.WinControls
  • Telerik.WinControls.PdfViewer
  • Telerik.WinControls.UI
  • Telerik.Windows.Documents.Core
  • Telerik.Windows.Documents.Fixed
  • TelerikCommon

The Telerik UI for WinForms assemblies can be install by using one of the available installation approaches.

Defining the RadPdfViewer

This article will help you quickly get started with RadPdfViewer. To start off, drag and drop RadPdfViewer the control from the toolbox to your form.

As of R1 2021 RadPdfViewer is optimized to utilize the RadPdfProcessing library model. The idea is to unify the underlying architecture of RadPdfViewer and Telerik PdfProcessing Library to allow feature parity.

Once you have RadPdfViewer, you can set the ViewerMode option to a desired value.

Figure 1: Visual Studio Designer

WinForms RadPdfViewer Visual Studio Designer

There is also a property for the above setting which you can set in your code:

ViewerMode Property

this.radPdfViewer1.ViewerMode = FixedDocumentViewerMode.TextSelection;

Me.RadPdfViewer1.ViewerMode = FixedDocumentViewerMode.TextSelection

Loading a PDF document is done via the LoadDocument method. It accepts either a filename or an input stream as an argument.

LoadDocument Method

this.radPdfViewer1.LoadDocument(Application.StartupPath + "\\PdfViewer\\Sample.pdf");

Me.RadPdfViewer1.LoadDocument(Application.StartupPath & "\PdfViewer\Sample.pdf")

The calls above will start to load the specified document asynchronously. When the loading finishes, the DocumentLoaded event will fire:

DocumentLoaded Event

void radPdfViewer1_DocumentLoaded(object sender, EventArgs e)
{
    RadMessageBox.Show("The document was loaded.");
}

Private Sub radPdfViewer1_DocumentLoaded(sender As Object, e As EventArgs)
    RadMessageBox.Show("The document was loaded.")
End Sub

Respectively, to unload a document, you can use the UnloadDocument method

UnloadDocument Method

this.radPdfViewer1.UnloadDocument();

Me.RadPdfViewer1.UnloadDocument()

To provide to the end-user an additional set of abilities for manipulating the document, you can use RadPdfViewerNavigator. To do this, drag it from the toolbox to your form and set its AssociatedViewer from its SmartTag menu.

Figure 2. RadPdfViewerNavigator

WinForms RadPdfViewer RadPdfViewerNavigator

You can also set this in your code by using the AssociatedPdfViewer property of the PdfViewerNavigator.

this.radPdfViewerNavigator1.AssociatedViewer = this.radPdfViewer1;

Me.RadPdfViewerNavigator1.AssociatedViewer = Me.RadPdfViewer1

Assembly References

If you add the RadPdfViewer at run time you need to add references to the following assemblies:

  • Telerik.WinControls.PdfViewer

  • Telerik.WinControls

  • Telerik.WinControls.UI

  • TelerikCommon

  • Telerik.Windows.Documents.Fixed

  • Telerik.Windows.Documents.Core

  • Telerik.Windows.Zip.dll

See Also

In this article