Getting started

keyboard_arrow_down
Running samplesTry demo in your projectDownloading PDFTronIntegrating PDFTron via GradleManually integrating PDFTronUpgradingAdding PDFTron license keyUsing ProGuardTroubleshooting integration

Fundamentals

keyboard_arrow_down
Document lockingSaving PDF documentsUnderstanding coordinates

Basics

keyboard_arrow_down
Using an ActivityUsing a FragmentUsing PDFViewCtrlViewer configConverting and viewing other document typesConverting HTML to PDF

Viewer

keyboard_arrow_down
PDFViewCtrl color modesPDFViewCtrl page view modePDFViewCtrl page presentation modeGenerating thumbnails in PDF

Features

keyboard_arrow_down
Day/Night themesUndo and redoText searchAnnotation syncingRotating PDF pagesPDFViewCtrl read onlyUsing PDFViewCtrl with minimum memory

Tools

keyboard_arrow_down
Tools overviewSetting Up ToolManagerChanging and disabling toolsIntercepting annotation handlingToolManager eventsDefault annotation propertiesTool subclasses

Annotations

keyboard_arrow_down

UI components

keyboard_arrow_down
Quick menuAnnotation toolbarAnnotation style dialogThumbnail sliderAnnotations listOutline listUser bookmarks listBookmarks dialogPage thumbnails dialogAdd page dialogRotate pages dialogView mode dialogCrop page dialogReflow

Advanced

keyboard_arrow_down
Adding a custom view to a PDF pageCustom toolCustomizing quick menuCustomizing annotation style dialog

FAQ

keyboard_arrow_down
Running project in Android StudioSystem RequirementsPDFTron full vs. standardLocalizationIcon cheat sheetRunning sample with sourceReducing size of APKEnable multidexOut of memory when rotating device multiple timesDetachCurrentThread warning

PDF Processing API

keyboard_arrow_down
What is PDFNet?Opening a documentSerializing (saving) a documentWorking with pagesWorking with Page ContentWorking with BookmarksWorking with Interactive Forms (AcroForms)PDF SecurityLow-level PDF APIError handling
Bookmarks dialogkeyboard_arrow_down

Bookmarks dialog fragment

In this document

The BookmarksDialogFragment dialog class provides a horizontal layout to display the following items in separate tabs:

  • annotations
  • document outline
  • user-defined bookmarks

linkHow to show bookmarks dialog

To create a new instance of the bookmarks dialog fragment call newInstance() and set the PDFViewCtrl as well as the dialogs to display using DialogFragmentTab:

ArrayList<DialogFragmentTab> dialogFragmentTabs = ...
BookmarksDialogFragment bookmarksDialogFragment = BookmarksDialogFragment.newInstance();
bookmarksDialogFragment.setPdfViewCtrl(pdfViewCtrl).setDialogFragmentTabs(dialogFragmentTabs);
bookmarksDialog.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.CustomAppTheme);
bookmarksDialogFragment.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
annotationsAnnotationDialogFragment.classTAG_TAB_ANNOTATION
document outlineOutlineDialogFragment.classTAG_TAB_OUTLINE
user bookmarksUserBookmarkDialogFragment.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:

BookmarksDialogFragment showBookmarksDialog(FragmentManager fragmentManager, PDFViewCtrl pdfViewCtrl) {
    DialogFragmentTab annotationsDialog = new DialogFragmentTab(
        AnnotationDialogFragment.class,
        BookmarksTabLayout.TAG_TAB_ANNOTATION,
        null,
        "Annotations",
        "Bookmarks Dialog",
        null);
    DialogFragmentTab outlineDialog = new DialogFragmentTab(
        UserBookmarkDialogFragment.class,
        BookmarksTabLayout.TAG_TAB_OUTLINE,
        null,
        "Outline",
        "Bookmarks Dialog",
        null);
    DialogFragmentTab userBookmarksDialog = new DialogFragmentTab(
        UserBookmarkDialogFragment.class,
        BookmarksTabLayout.TAG_TAB_BOOKMARK,
        null,
        "User Bookmarks",
        "Bookmarks Dialog",
        null);
    ArrayList<DialogFragmentTab> dialogFragmentTabs = new ArrayList<>();
    dialogFragmentTabs.add(annotationsDialog);
    dialogFragmentTabs.add(outlineDialog);
    dialogFragmentTabs.add(userBookmarksDialog);
    BookmarksDialogFragment bookmarksDialog = BookmarksDialogFragment.newInstance();
    bookmarksDialog.setPdfViewCtrl(pdfViewCtrl)
        .setDialogFragmentTabs(dialogFragmentTabs)
        .setBookmarksDialogListener(this)
        .setBookmarksTabsListener(this);
    bookmarksDialog.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.CustomAppTheme);   
    bookmarksDialog.show(fragmentManager, "bookmarks_dialog");
    return bookmarksDialog;
}

@Override
public void onBookmarksDialogDismissed(int tabIndex) {
    // the bookmarks dialog was dismissed
}

@Override
public void onUserBookmarkClick(int pageNum) {
    // a user bookmark was clicked
}

@Override
public void onOutlineClicked(Bookmark parent, Bookmark bookmark) {
    // an outline was clicked
}

@Override
public void onAnnotationClicked(Annot annotation, int pageNum) {
    // an annotation was clicked
}

@Override
public void onExportAnnotationsClicked() {
    // the export annotation button was clicked
}