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.
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.
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?
Can you please send us (https://xfiniumpdf.com/xfinium-pdf-contact-us.html) your test application so we can take a look at it?
At this moment we do not have a native viewer for Xamarin.Forms, you have to use a custom renderer.
Not able to find class ‘PdfDocumentView’ in the xfinium package for the uwp. Which package or nuget need to add in the project?
The PDF viewer for UWP is not available as a nuget package yet.
Please download this sample to see how to use the PDF viewer control in UWP:
https://pdf.dev/download/customersamples/xfinium.pdf.viewer.uwp.demo.zip
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?
pdf page is not displayed when pdfcoreview zoomed in. How to solve this issue?
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?
Can you please send us (https://xfiniumpdf.com/xfinium-pdf-contact-us.html) your test application so we can take a look at it?