Outline tree

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 Android

The OutlineDialogFragment displays a document outline (containing PDF Bookmarks that can be used to navigate the PDF document by selecting a bookmark item.

Apryse Docs Image

Show outline dialog

To show an outline dialog fragment in your activity, create a new instance of OutlineDialogFragment by calling newInstance() and setting the PDFViewCtrl:

1BookmarksDialogFragment showBookmarksDialog(FragmentManager fragmentManager, PDFViewCtrl pdfViewCtrl) {
2 DialogFragmentTab outlineDialog = new DialogFragmentTab(
3 UserBookmarkDialogFragment.class,
4 BookmarksTabLayout.TAG_TAB_OUTLINE,
5 null,
6 "Outline",
7 "Bookmarks Dialog",
8 null);
9 ArrayList<DialogFragmentTab> dialogFragmentTabs = new ArrayList<>();
10 dialogFragmentTabs.add(outlineDialog);
11
12 BookmarksDialogFragment bookmarksDialog = BookmarksDialogFragment.newInstance();
13 bookmarksDialog.setPdfViewCtrl(pdfViewCtrl)
14 .setDialogFragmentTabs(dialogFragmentTabs);
15 bookmarksDialog.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.PDFTronAppTheme);
16 bookmarksDialog.show(fragmentManager, "bookmarks_dialog");
17 return bookmarksDialog;
18}

You can also set the current bookmark using setCurrentBookmark(Bookmark).

Listener

You can set a listener to be notified when an item in an OutlineDialogFragment is clicked by calling setOutlineDialogListener(OutlineDialogListener).

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales