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

Getting started

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.
pdfviewer-getting-started 003

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

Figure 1: Visual Studio Designer

pdfviewer-getting-started 001

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



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

pdfviewer-getting-started 002

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
Not finding the help you need? Improve this article