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, in your project.

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

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

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

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.

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.

documentView.GraphicRendererFactory = new Xfinium.Graphics.CoreGraphics.CoreGraphicsRendererFactory();
documentView.Document = new Xfinium.Pdf.View.PdfVisualDocument();
FileStream pdfStream = File.OpenRead("xfinium.pdf");

9. Run the application.

Leave a Reply

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

%d bloggers like this: