Getting started with XFINIUM.PDF Viewer in Mac applications

This tutorial will show how to get started with XFINIUM.PDF Viewer in Xamarin.Mac applications.

1. Create a new Mac application using Visual Studio for Mac.

Getting started with XFINIUM.PDF viewer in Xamarin.Mac applications

2. Add references to xfinium.pdf.xamarin.mac.dll, xfinium.pdf.render.xamarin.mac.dll, xfinium.pdf.view.xamarin.mac.dll, xfinium.graphics.xamarin.mac.coregraphics.dll in your project.

Getting started with XFINIUM.PDF viewer in Xamarin.Mac applications

3. Open the application storyboard with Xcode/Interface Builder and add a custom view to it.

Getting started with XFINIUM.PDF viewer in Xamarin.Mac applications

4. Set the custom view’s Class to PdfCoreView and embed it in a scroll view.

Getting started with XFINIUM.PDF viewer in Xamarin.Mac applications

5. Create an outlet for the custom view and set its name to ‘documentView‘ (ignore the error about unknown type ‘PdfCoreView‘ in Xcode).

Getting started with XFINIUM.PDF viewer in Xamarin.Mac applications

6. Save all the changes, close Xcode and return to Visual Studio for Mac.

7. Add a test PDF file to application’s Resources folder.

Getting started with XFINIUM.PDF viewer in Xamarin.Mac applications

8. In view controller’s ViewDidLoad method create a PdfVisualDocument object, set the documentView.Document property with the PdfVisualDocument object and load a file in the document.

Getting started with XFINIUM.PDF viewer in Xamarin.Mac applications

9. Run the application.

Getting started with XFINIUM.PDF viewer in Xamarin.Mac applications

Leave a Reply