Some test text!

Search
Hamburger Icon

Xamarin / Android

Outline tree (Android)

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

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

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

Outline dialog

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:

fun showBookmarksDialog(fragmentManager: FragmentManager, pdfViewCtrl: PDFViewCtrl): BookmarksDialogFragment {
    var bookmarksDialog = pdftron.PDF.Dialog.BookmarksDialogFragment.NewInstance();
    bookmarksDialog.SetPdfViewCtrl(pdfViewCtrl);
    List<DialogFragmentTab> tabs = new List<DialogFragmentTab>();
    var outlineDialog = new DialogFragmentTab(
        Java.Lang.Class.FromType(typeof(OutlineDialogFragment)), BookmarksTabLayout.TagTabOutline, null, "Outline", "Bookmarks Dialog", null);
    tabs.Add(outlineDialog);
    bookmarksDialog.SetDialogFragmentTabs(tabs);
    bookmarksDialog.SetStyle((int)DialogFragmentStyle.NoTitle, Resource.Style.PDFTronAppTheme);
    bookmarksDialog.Show(fragmentManager, "bookmarks_dialog");
    return bookmarksDialog;
}

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).

Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales