Using document viewer controller

In this document
chevron_rightShowing a document
This article only applies to Xamarin.iOS.

The PTDocumentViewController shows a PDF viewer and annotator complete with controls such as an annotation toolbar, page layout controls, bookmarks, thumbnail viewer, etc. All of its component pieces are part of the Tools framework, and this class packages them into one easy to use view controller.

For a version of PTDocumentViewController that supports multiple documents, see PTTabbedDocumentViewController

Using PTDocumentViewController in Xamarin.iOS is identical to using PTDocumentViewController in iOS. See tutorial here.

linkShowing a document

PTDocumentViewController documentViewController = new PTDocumentViewController();
UINavigationController navigationController = new UINavigationController(documentViewController);
NSUrl fileURL = NSBundle.MainBundle.GetUrlForResource("sample", "pdf");
NSError error = null;
bool success = documentViewController.OpenDocumentWithURL(fileURL, out error);
if (!success)
    Console.WriteLine("OpenDocumentWithURL failed...");
documentViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (sender, e) => {
    documentViewController.DismissViewController(true, null);
this.PresentViewController(navigationController, true, null);