Getting started with XFINIUM.PDF Viewer in UWP applications

This tutorial will show how to get started with XFINIUM.PDF Viewer in UWP Windows 10 applications.

1. Open your page xaml in Visual Studio Designer.

Getting started with XFINIUM.PDF viewer in UWP applications

2. Drag a PdfDocumentView control from the toolbox onto the page and name the control ‘documentView‘. A reference to XFINIUM.PDF Viewer for UWP SDK will be added automatically to your project.

3. Add a test PDF file to your project and set its build action to EmbeddedResource.

4. In your page’s Loaded event create a PdfVisualDocument object, set the documentView.Document property with the PdfVisualDocument object and load a file in the document.

C#

Xfinium.Pdf.View.PdfVisualDocument document = new Xfinium.Pdf.View.PdfVisualDocument();
documentView.Document = document;
Assembly assembly = typeof(MainPage).GetTypeInfo().Assembly;
Stream pdfStream = assembly.GetManifestResourceStream("XFINIUMPDFViewerForUWP.xfinium.pdf");
document.Load(pdfStream);
pdfStream.Dispose();

VB

Dim document As New Xfinium.Pdf.View.PdfVisualDocument()
documentView.Document = document
Dim assembly As Assembly = GetType(MainPage).GetTypeInfo().Assembly
Dim pdfStream As Stream = assembly.GetManifestResourceStream("XFINIUMPDFViewerForUWP.xfinium.pdf")
document.Load(pdfStream)
pdfStream.Dispose()

5. Run the application.

8 thoughts on “Getting started with XFINIUM.PDF Viewer in UWP applications”

  1. I tried out the trial version 8.0.0, but I can’t get this to work in a Xamarin.UWP App – it works for Mac, iOS and Android, but not in Xamarin.UWP. It’s throwing a Runtime exception in Xfinium.PDF.View failing to find System.Runtime.WindowsRuntime on startup – any hints?

  2. I need an event ‘PageNumberChanged’ to get changed page number which are getting me in the Android and iOS but not in the UWP. How I will get the page number updation event from the PdfCoreView?

  3. pdf page is not displayed when pdfcoreview zoomed in. How to solve this issue?

  4. the documentation is very very poor, and like the first coment, Im also getting a winrt error class not registered as soon as I try to open a pdf on uwp implementation, using commercial 9.0 edition. Could you plz tell me what is wrong?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: