Some test text!

menu
List containerkeyboard_arrow_down

List Container

The list container is a UI component that contains other components related to annotations and bookmarks.

List container to customize horizontal menu layout in Xamarin.Android

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

The list container provides a horizontal layout to display the following items in separate tabs:

Bookmarks dialog

linkShow list container

The list container is implemented by the BookmarksDialogFragment class. To show this fragment in your activity, create a new instance of BookmarksDialogFragment by calling newInstance(). Afterwards, initialize your fragment by setting the PDFViewCtrl and an ArrayList of DialogFragmentTab:

private PDFViewCtrl mPdfViewCtrl;
// ...
public void ShowBookmarksDialog(List<DialogFragmentTab> dialogFragmentTabs,
                                FragmentManager fragmentManager) {
    var fragment = BookmarksDialogFragment.NewInstance();
    fragment.SetPdfViewCtrl(mPdfViewCtrl)
            .SetDialogFragmentTabs(dialogFragmentTabs);
    // Set a custom style for this fragment
    fragment.SetStyle((int)DialogFragmentStyle.NoTitle, Resource.Style.CustomAppTheme);
    // Show the dialog
    fragment.Show(fragmentManager, "bookmarks_dialog");
}

DialogFragmentTab specifies the information about each tab including the type of class and the tab tag. You can create an instance of DialogFragmentTab using DialogFragmentTab(Class<?>, String). Currently the following dialogs can be displayed within the bookmarks dialog:

DialogType of classTab tag
Annotation listAnnotationDialogFragment.classTAG_TAB_ANNOTATION
Document outlineOutlineDialogFragment.classTAG_TAB_OUTLINE
User bookmark listUserBookmarkDialogFragment.classTAG_TAB_BOOKMARK

The following example shows how to display an annotations list, a document outline, and a user-defined bookmark list tabs in BookmarksDialogFragment:

using pdftron.PDF.Tools.Utils;

var bookmarksDialog = pdftron.PDF.Dialog.BookmarksDialogFragment.NewInstance();
bookmarksDialog.SetPdfViewCtrl(mPdfViewCtrl);
List<DialogFragmentTab> tabs = new List<DialogFragmentTab>();
var annotationsTab = new DialogFragmentTab(
    Java.Lang.Class.FromType(typeof(AnnotationDialogFragment)), BookmarksTabLayout.TagTabAnnotation, null, "Annotations", "Bookmarks Dialog", null);
var outlineDialog = new DialogFragmentTab(
    Java.Lang.Class.FromType(typeof(OutlineDialogFragment)), BookmarksTabLayout.TagTabOutline, null, "Outline", "Bookmarks Dialog", null);
var userBookmarksDialog = new DialogFragmentTab(
    Java.Lang.Class.FromType(typeof(UserBookmarkDialogFragment)), BookmarksTabLayout.TagTabBookmark, null, "User Bookmarks", "Bookmarks Dialog", null);
tabs.Add(annotationsTab);
tabs.Add(outlineDialog);
tabs.Add(userBookmarksDialog);
bookmarksDialog.SetDialogFragmentTabs(tabs);
bookmarksDialog.SetStyle((int)DialogFragmentStyle.NoTitle, Resource.Style.CustomAppTheme);
bookmarksDialog.Show(this.SupportFragmentManager, "bookmarks_dialog");
bookmarksDialog.AnnotationClicked += (sender, e) =>
{
    bookmarksDialog.Dismiss();
};
bookmarksDialog.ExportAnnotations += (sender, e) =>
{
    // handle export annotations here
    bookmarksDialog.Dismiss();
};
bookmarksDialog.OutlineClicked += (sender, e) =>
{
    bookmarksDialog.Dismiss();
};
bookmarksDialog.UserBookmarkClick += (sender, e) =>
{
    mPdfViewCtrl.SetCurrentPage(e.PageNum);
    bookmarksDialog.Dismiss();
};

linkCustomization

The BookmarksDialogFragment provides a flexible API for displaying only the desired child view. Any of the annotation list, document outline, or user-defined bookmark list view can be removed by omitting them from the DialogFragmentTabs.

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.

Join our live demo to learn about use cases & capabilities for WebViewer

Learn more
close