Some test text!

menu

Open a document (iOS)

You have a few options to open a document such as with a document view controller or tabbed document view controller.

Document view controller in Xamarin.iOS

The PTDocumentController 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 PTDocumentController that supports multiple documents, see PTTabbedDocumentViewController.

Document Viewer
The document viewer includes a convenient document interaction and annotation toolbar at the top as well as convenient access to a number of powerful built-in components.

The PTDocumentController is a subclass of the PTDocumentBaseViewController from which it inherits much of its functionality.

linkShow a document

The document viewer is part of the Tools library, so make sure you have added the Tools library to your project.

The following shows how to create a document viewer, set the document to display, and present it on screen.

PTDocumentController documentController = new PTDocumentController();
UINavigationController navigationController = new UINavigationController(documentController);
NSUrl fileURL = NSBundle.MainBundle.GetUrlForResource("sample", "pdf");

documentController.OpenDocumentWithURL(fileURL);

documentController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (sender, e) => {
    documentController.DismissViewController(true, null);
});
this.PresentViewController(navigationController, true, null);

linkRespond to Opening Events

openDocumentWithURL: is an asynchronous method. To respond to errors or other events that occur during opening, assign an object that conforms to the PTDocumentControllerDelegate to the PTDocumentController's delegate property and implement the following optional methods:

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.