Skip to content

Xamarin example app for PSPDFKit for Windows UWP. (Windows PDF SDK)

License

Notifications You must be signed in to change notification settings

PSPDFKit/Xamarin-UWP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xamarin.Forms UWP Sample

PSPDFKit

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.

Related

Support, Issues and License Questions

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/

Running Xamarin.Forms UWP Sample

Requirements

In order to build this project you need:

Running the sample project

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.

Using PSPDFKit for Windows in your Xamarin.Forms UWP 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.

Xamarin.Forms Custom Control

  • 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.

Releases

No releases published

Packages

No packages published