Some test text!

Page labels editor (Android)

Page label editor

You can choose to edit page labels programmatically or with a graphical UI.

Edit PDF page labels in Xamarin.Android

This tutorial only applies to Xamarin.Android.

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.


Show 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)
    var dialog = pdftron.PDF.Dialog.PageLabel.PageLabelDialog.NewInstance(fromPage, toPage, pageCount);
    dialog.SetStyle((int)DialogFragmentStyle.NoTitle, Resource.Style.PDFTronAppTheme);
    dialog.Show(fragmentManager, "page_label_dialog");

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 class MyActivity : AppCompatActivity, Android.Arch.Lifecycle.IObserver
    public void PageLabelObserveOnComplete(AppCompatActivity activity, PDFViewCtrl pdfViewCtrl)
        var viewModel = ViewModelProviders.Of(activity).Get(Java.Lang.Class.FromType(typeof(pdftron.PDF.Dialog.PageLabel.PageLabelSettingViewModel))) as pdftron.PDF.Dialog.PageLabel.PageLabelSettingViewModel;
        viewModel.ObserveOnComplete(activity, this);

    public void OnChanged(Java.Lang.Object p0)
        if (p0 is pdftron.PDF.Tools.Utils.Event)
            var someEvent = p0 as pdftron.PDF.Tools.Utils.Event;
            if (!someEvent.HasBeenHandled)
                var actualEvent = someEvent.ContentIfNotHandled;
                if (actualEvent is pdftron.PDF.Dialog.PageLabel.PageLabelSetting)
                    var pageLabelSettingEvent = actualEvent as pdftron.PDF.Dialog.PageLabel.PageLabelSetting;
                    pdftron.PDF.Dialog.PageLabel.PageLabelUtils.SetPageLabel(mPdfViewCtrl, pageLabelSettingEvent);

Get the answers you need: Support

Upcoming Webinar: PDFTron SDK Tech Review | Nov 29, 2022 at 2 pm ET


The Platform


© 2022 PDFTron Systems Inc. All rights reserved.


Terms of Use