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

Getting Started

This article will guide you through the steps needed to add a basic RadPdfViewer control in your application.

1. Setting up the app

Start by setting up the app. See the following articles for detailed instructions:

2. Adding the required Telerik references

To add the required Telerik references to your project, choose one of the three options:

  • Add the entire Telerik.UI.for.Xamarin NuGet package.
  • Add only the Telerik.UI.for.Xamarin.PdfViewer NuGet package.

    The NuGet package manager will automatically add the following dependencies: Telerik.UI.for.Xamarin.Common, Telerik.UI.for.Xamarin.Primitives, Telerik.UI.for.Xamarin.SkiaSharp, SkiaSharp and SkiaSharp.Views.Forms.

  • Add the references to all required Telerik assemblies manually.

    The following table presents the required assemblies for the RadPdfViewer component:

    Platform Assemblies
    Portable Telerik.Documents.Core.dll
    Telerik.Documents.Fixed.dll
    Telerik.XamarinForms.PdfViewer.dll
    Telerik.XamarinForms.Common.dll
    Telerik.XamarinForms.Primitives.dll
    Telerik.XamarinForms.SkiaSharp.dll
    Android Telerik.Documents.Core.dll
    Telerik.Documents.Fixed.dll
    Telerik.Xamarin.Android.Primitives.dll
    Telerik.Xamarin.Android.Common.dll
    Telerik.XamarinForms.PdfViewer.dll
    Telerik.XamarinForms.Common.dll
    Telerik.XamarinForms.Primitives.dll
    Telerik.XamarinForms.SkiaSharp.dll
    iOS Telerik.Documents.Core.dll
    Telerik.Documents.Fixed.dll
    Telerik.Xamarin.iOS.dll
    Telerik.XamarinForms.PdfViewer.dll
    Telerik.XamarinForms.Common.dll
    Telerik.XamarinForms.Primitives.dll
    Telerik.XamarinForms.SkiaSharp.dll
    UWP Telerik.Core.dll
    Telerik.Documents.Core.dll
    Telerik.Documents.Fixed.dll
    Telerik.UI.Xaml.Primitives.UWP.dll
    Telerik.XamarinForms.PdfViewer.dll
    Telerik.XamarinForms.Common.dll
    Telerik.XamarinForms.Primitives
    Telerik.XamarinForms.SkiaSharp.dll

Add a reference to the Telerik.Documents.Core.dll and Telerik.Documents.Fixed.dll assemblies to each project. The assemblies are located in the \Binaries\Portable folder of your Telerik UI for Xamarin installation.

3. Adding RadPdfViewer control

Use one of the following approaches:

Drag the control from the Toolbox.

Take a look at the following topics on how to use the toolbox:

Create the control definition in XAML.

<telerikPdfViewer:RadPdfViewer x:Name="pdfViewer" />

After you create the control definition, add the following namespace:

xmlns:telerikPdfViewer="clr-namespace:Telerik.XamarinForms.PdfViewer;assembly=Telerik.XamarinForms.PdfViewer"

4. Visualize a Pdf Document

To visualize the pdf document, set the Source property of the control:

Func<CancellationToken, Task<Stream>> streamFunc = ct => Task.Run(() =>
{
    Assembly assembly = typeof(PdfViewerGettingStartedXaml).Assembly;
    string fileName = assembly.GetManifestResourceNames().FirstOrDefault(n => n.Contains("pdfviewer-overview.pdf"));
    Stream stream = assembly.GetManifestResourceStream(fileName);
    return stream;
});
this.pdfViewer.Source = streamFunc;

This is the result:

PdfViewer Getting Started Example

The example below shows a pdf document visualized as an EmbeddedResource. This is one of the options for loading a pdf with the PdfViewer control. For all available options, see the Key Features topic.

See Also

In this article
Not finding the help you need? Improve this article