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

Getting Started with WinUI PdfViewer

This guide provides the information you need to start using the Telerik UI for WinUI PdfViewer by adding the component to your project.

At the end, you will be able to achieve the following result.

WinUI RadPdfViewer RadPdfViewer Example 1

Prerequisites

Before adding the PdfViewer, you need to:

  1. Set up your WinUI project.

  2. Create your Telerik UI for WinUI application and install the Telerik UI for WinUI components depending on the required installation approach:

Add the Assembly References

To use the RadPdfViewer component, add references to the following assemblies:

  • Telerik.WinUI.Controls.dll
  • Telerik.WinUI.Controls.PdfViewer.dll
  • Telerik.Documents.Fixed.dll
  • Telerik.Documents.Core
  • Telerik.Zip.dll
  • Microsoft.Graphics.Win2D NuGet package (version 1.0.1 and later)

Define the Component

To render a PDF file using the RadPdfViewer control, define it and set its DocumentSource property. You can access the PdfViewer through the xmlns:telerik="using:Telerik.UI.Xaml.Controls" alias that points to the Telerik.UI.Xaml.Controls namespace.

Setting up the Pdf

<telerik:RadPdfViewer DocumentSource="ms-appx:///PdfFiles/Sample.pdf"/>  
WinUI RadPdfViewer

Define the Toolbar

The PdfViewer comes with a built-in toolbar component which has a set of predefined options. To use it, add the RadPdfViewerToolBar control in the view and set its RadPdfViewer property.

Setting up the toolbar

<Grid> 
    <Grid.RowDefinitions> 
        <RowDefinition Height="Auto"/> 
        <RowDefinition/> 
    </Grid.RowDefinitions> 
    <telerik:RadPdfViewerToolBar RadPdfViewer="{Binding ElementName=pdfViewer, Mode=OneTime}"  /> 
    <telerik:RadPdfViewer Grid.Row="1" 
                          x:Name="pdfViewer"  
                          DocumentSource="ms-appx:///PdfFiles/Sample.pdf" /> 
</Grid> 
WinUI RadPdfViewer

Telerik UI for WinUI Learning Resources

See Also

In this article
Not finding the help you need?