The PSPDFKit SDK is a framework that allows you to view, annotate, sign, and fill PDF forms on iOS, Android, Windows, macOS, and Web.
PSPDFKit Instant adds real-time collaboration features to seamlessly share, edit, and annotate PDF documents.
- Xamarin.Android Bindings for PSPDFKit for Android: PSPDFKit/Xamarin-Android
- Xamarin.iOS Bindings for PSPDFKit for iOS: PSPDFKit/Xamarin-iOS
Note
- Nutrient Xamarin SDK (formerly PSPDFKit Xamarin for iOS and PSPDFKit Xamarin for Android) is being sunset and replaced by Nutrient .NET for iOS and Nutrient .NET for Android. All Nutrient Xamarin licenses will remain valid and fully supported until 1 December 2025, or until your license expires, whichever occurs later.
- Nutrient UWP SDK (formerly PSPDFKit for Windows) is being sunset, in line with Microsoft’s decision to gradually phase out UWP by limiting updates to bug fixes and security patches. All Nutrient UWP licenses will continue to work and be supported until 1 December 2026, or until your license expires, whichever occurs later.
Interested in transitioning to another Nutrient product? Contact us and we’ll be happy to help.
PSPDFKit offers support for customers with an active SDK license via https://pspdfkit.com/support/request/
Are you evaluating our SDK? That's great, we're happy to help out! To make sure this is fast, please use a work email and have someone from your company fill out our sales form: https://pspdfkit.com/sales/
In order to build this project you need:
- Windows 10
- Visual Studio 2017 or 2019
- PSPDFKit for Windows trial license. (get your trial here)
- Visual Studio Tools for Xamarin
- Getting familiar with Xamarin.Forms UWP project setup.
Open XamarinPDF.sln
using Visual Studio and add your license key as a String value in the App.xaml
file listed below:
Replace LICENSE_KEY_GOES_HERE
with your provided license from the PSPDFKit customer portal or trial key.
<ResourceDictionary>
<x:String x:Key="PSPDFKitLicense">LICENSE_KEY_GOES_HERE</x:String>
</ResourceDictionary>
You can now build and run the project.
First you need to follow the PSPDFKit for Windows integration guide then you can create a Xamarin.Forms control that inherits from Xamarin.Forms.View which can be used to host the actual PdfView using a Xamarin.Forms custom renderer technique. We encourage you to read Xamarin.Forms Implementing a View documentation, we use this pathern in the example project.
- PdfViewer.cs: This is the Xamarin.Forms custom control that is used to represent a PdfView in the Xamarin.Forms context. In this particular example it mirrors properties that are bindable from a XAML context.
- PdfViewerRenderer.cs: This is the class that will actually contain the PdfView object initialization and implementation,
PdfViewerRenderer.cs
is hosted in the UWP project context, so it has access to all UWP platform features. Creating the Custom Renderer on UWP document goes into greater detail on this subject.
Now that you have both pieces in place, you can use PdfViewer.cs from the Xamarin.Forms XAML context like this:
<ContentPage.Content>
<PdfViewer
License="{StaticResource PSPDFKitLicense}"
PdfUriSource="ms-appx:///Assets/pdfs/default.pdf"/>
</ContentPage.Content>
Note:
PdfViewer.cs and PdfViewerRenderer.cs are just provided as a way to achieve rendering a PDF within a Xamarin.Forms UWP application, you can definitely achieve the same result by creating a UWP page to host the PdfView and your own UWP logic and just use a
Xamarin.Forms.ContentPage
as a container of said UWP page. This is also demonstrated in this sample on PrintPageContainer.cs, PrintPageRenderer.cs, PrintPage.xaml.cs and PrintPage.xaml.