Some test text!

platform
search

Page label editor

Contents

Show the page label editor

The PageLabelDialogFragment allows you to add or modify the page labels in a PDF document. Page labels are typically used to describe a page, such as allowing for non-sequential page numbering (such as the inclusion of Roman numerals at the beginning of a book) or the addition of arbitrary labels.

linkShow the page label editor

The page label editor can be shown from an activity by calling the following method:

public void showPageLabelSettingsDialog(FragmentManager fragmentManager, int fromPage, int toPage, int pageCount) {
    PageLabelDialog dialog = PageLabelDialog.newInstance(fromPage, toPage, pageCount);
    dialog.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.CustomAppTheme);
    dialog.show(fragmentManager, PageLabelDialog.TAG);
}

In order to recieve the inputs from the page label editor, you will also need to subscribe to completion events from the page label dialog:

public void observeOnComplete(final FragmentActivity activity, final PDFViewCtrl pdfViewCtrl) {
    PageLabelSettingViewModel viewModel = ViewModelProviders.of(activity).get(PageLabelSettingViewModel.class);
    viewModel.observeOnComplete(activity, new Observer<Event<PageLabelSetting>>() {
        @Override
        public void onChanged(@Nullable Event<PageLabelSetting> pageLabelSettingEvent) {
            // Handle the completion event from the page label dialog,
            // and change the page labels in PDFViewCtrl
            if (pageLabelSettingEvent != null && !pageLabelSettingEvent.hasBeenHandled()) {
                PageLabelUtils.setPageLabel(pdfViewCtrl, pageLabelSettingEvent.getContentIfNotHandled());
            }
        }
    });
}

Get the anwsers you need: Support

Contents

Show the page label editor