# 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](http://tv.telerik.com/watch/radcontrols-for-winforms/getting-started-with-the-winforms-radpdfviewer)<br>**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](https://www.telerik.com/products/winforms/documentation/assets/e17e89b601abbdff95862e490879331f/pdfviewer-getting-started003.png) |

## 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](https://www.telerik.com/products/winforms/documentation/visual-studio-integration/available-nugets).

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](https://www.telerik.com/products/winforms/documentation/installation-and-upgrades/install-using-nuget) article.

> tip With the 2025 Q1 release, the Telerik UI for WinForms has a new licensing mechanism. You can learn more about it [here](https://www.telerik.com/products/winforms/documentation/licensing/license-key).

## 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 installed by using one of the available [installation approaches](https://www.telerik.com/products/winforms/documentation/installation-and-upgrades/installing-on-your-computer).

## 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](https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/overview) 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.

> caption Figure 1: Visual Studio Designer

![WinForms RadPdfViewer Visual Studio Designer](https://www.telerik.com/products/winforms/documentation/assets/d6b77bc280c1d631764efc5a4df0ea8a/pdfviewer-getting-started001.png)

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

#### ViewerMode Property

```C#
this.radPdfViewer1.ViewerMode = FixedDocumentViewerMode.TextSelection;

```

```VB.NET
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

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

```

```VB.NET
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

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

```

```VB.NET
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

```C#
this.radPdfViewer1.UnloadDocument();

```

```VB.NET
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.

> caption Figure 2. RadPdfViewerNavigator

![WinForms RadPdfViewer RadPdfViewerNavigator](https://www.telerik.com/products/winforms/documentation/assets/b6e291dfcd0632c2bea76a2cef3e0180/pdfviewer-getting-started002.png)

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

```C#
this.radPdfViewerNavigator1.AssociatedViewer = this.radPdfViewer1;

```

```VB.NET
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

* [Logical Structure](https://www.telerik.com/products/winforms/documentation/controls/pdfviewer/structure/logical-structure)
* [Visual Structure](https://www.telerik.com/products/winforms/documentation/controls/pdfviewer/structure/visual-structure)
