Outline tree (iOS)

There are two options to working with an outline tree. First is using a UI component that provides tools to set a bookmark or display the outline. Second is an API guide to programmatically read outline items.

Display outlines & bookmarks in Xamarin.iOS

This tutorial only applies to Xamarin.iOS. See Xamarin.Android equivalent here .

A document outline, or table of contents, demonstrates how the PDF document is organized and helps users see the overall picture. The PTOutlineViewController class shows the document outline (table of contents) that can be used to navigate through the document being viewed by a PTPDFViewCtrl by tapping on a bookmark item.

Apryse Docs Image

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

Show an outline view controller

To create a new outline view controller instance and display it from another view controller, supply a PTPDFViewCtrl instance to the PTOutlineViewController designated initializer:

C#

1var outlineViewController = new pdftron.PDF.Controls.PTOutlineViewController (mPdfViewCtrl);
2outlineViewController.OutlineViewControllerOutlineSelected += (sender, e) => {
3 // perform custom action
4 this.DismissViewController (true, null);
5};
6outlineViewController.OutlineViewControllerDidCancel += (object sender, EventArgs e) => {
7 this.DismissViewController (true, null);
8};
9
10var navigationController = new UINavigationController (outlineViewController);
11
12if (UserInterfaceIdiomIsPad)
13{
14 navigationController.ModalPresentationStyle = UIModalPresentationStyle.Popover;
15 navigationController.PopoverPresentationController.BarButtonItem = outlineButton;
16}
17
18this.PresentViewController (navigationController, true, null);

The outline view controller must be pushed onto a navigation controller's stack before being shown.

Presenting on iPads:

The outline view controller is designed to be presented in a popover on iPads. To do so, you must provide the PTOutlineViewController's PopoverPresentationController with either:

OR

as in the example above.

You can set a delegate to be notified by the outline view controller when outline bookmarks are selected with the PTOutlineViewControllerDelegate protocol. (See the CompleteReader example for usage of an PTOutlineViewController.)

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales