User bookmarks list

Apryse SDK allows you to create a maintain a list of user defined bookmarks.

User-defined bookmarks for Xamarin.Android

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

User-defined bookmarks are an Apryse specific feature that may not show in other PDF viewer applications. If you want to manage PDF bookmarks so that they can be processed in other standard PDF viewers, see the document outline guide .

The UserBookmarkDialogFragment displays a list of user-defined bookmarks that can be used to navigate the document.

Apryse Docs Image

Show user bookmark dialog

To show a user bookmark dialog fragment in your activity, create a new instance of UserBookmarkDialogFragment by calling newInstance() and setting the PDFViewCtrl:

C#

1fun showBookmarksDialog(fragmentManager: FragmentManager, pdfViewCtrl: PDFViewCtrl): BookmarksDialogFragment {
2 var bookmarksDialog = pdftron.PDF.Dialog.BookmarksDialogFragment.NewInstance();
3 bookmarksDialog.SetPdfViewCtrl(pdfViewCtrl);
4 List<DialogFragmentTab> tabs = new List<DialogFragmentTab>();
5 var userBookmarksDialog = new DialogFragmentTab(
6 Java.Lang.Class.FromType(typeof(UserBookmarkDialogFragment)), BookmarksTabLayout.TagTabBookmark, null, "User Bookmarks", "Bookmarks Dialog", null);
7 tabs.Add(userBookmarksDialog);
8 bookmarksDialog.SetDialogFragmentTabs(tabs);
9 bookmarksDialog.SetStyle((int)DialogFragmentStyle.NoTitle, Resource.Style.PDFTronAppTheme);
10 bookmarksDialog.Show(fragmentManager, "bookmarks_dialog");
11 return bookmarksDialog;
12}

Listener

You can set a listener to be notified when a user bookmark is clicked by calling setUserBookmarkListener(UserBookmarkDialogListener).

Read-only

If the document has write access, users can add new user bookmarks using floating action button. To specify whether the document is read-only call setReadOnly(boolean).

Import and export

It is possible to import and export user bookmarks in JSON format. Typical use case is to save and load the user bookmarks JSON from a server.

The user bookmark JSON is a dictionary with page indices as keys and the bookmark title as the values. For example: {"0":"Bookmark 1","2":"Bookmark 2"}. Behaviour is undefined otherwise. Note that the page indices will be 0-indexed similar to XFDF.

C#

1// import
2BookmarkManager.ImportPdfBookmarks(PDFViewCtrl, String)
3// export
4BookmarkManager.ExportPdfBookmarks(PDFDoc)

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales