Getting Started
This article will guide you through the steps needed to add a basic RadPdfViewer control in your application.
- Setting up the app
- Adding the required Telerik references
- Adding RadPdfViewer control
- Visualize a Pdf Document
1. Setting up the app
Take a look at these articles and follow the instructions to setup your app:
2. Adding the required Telerik references
You have two options:
Add the Telerik UI for Xamarin Nuget packages following the instructions in Telerik NuGet package server topic.
Add the references to Telerik assemblies manually, check the list below with the required assemblies for RadPdfViewer component:
Platform | Assemblies |
---|---|
Portable | Telerik.Documents.Core.dll Telerik.Documents.Fixed.dll Telerik.Zip.dll Telerik.XamarinForms.PdfViewer.dll Telerik.XamarinForms.SkiaSharp.dll |
Android | Telerik.Documents.Core.dll Telerik.Documents.Fixed.dll Telerik.Zip.dll Telerik.XamarinForms.PdfViewer.dll Telerik.Xamarin.Android.Primitives.dll Telerik.XamarinForms.Common.dll Telerik.XamarinForms.SkiaSharp.dll |
iOS | Telerik.Documents.Core.dll Telerik.Documents.Fixed.dll Telerik.Zip.dll Telerik.Xamarin.iOS.dll Telerik.XamarinForms.PdfViewer.dll Telerik.XamarinForms.Common.dll Telerik.XamarinForms.Input.dll Telerik.XamarinForms.DataControls.dll |
UWP | Telerik.Documents.Core.dll Telerik.Documents.Fixed.dll Telerik.Zip.dll Telerik.Data.dll Telerik.UI.Xaml.Controls.Data.UWP.dll Telerik.UI.Xaml.Primitives.UWP.dll Telerik.XamarinForms.PdfViewer.dll Telerik.XamarinForms.Common.dll |
3. Adding RadPdfViewer control
You could 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" />
In addition to this, you need to 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 you will need to set the Source property of the control.
- Source (DocumentSource): Defines the source of the document.
Assembly assembly = typeof(PdfViewerGettingStartedXaml).Assembly;
string fileName = assembly.GetManifestResourceNames().FirstOrDefault(n => n.Contains("pdfviewer-overview.pdf"));
if (!string.IsNullOrEmpty(fileName))
{
this.pdfViewer.Source = assembly.GetManifestResourceStream(fileName);
}
This is the result: