Some test text!

platform
search

Page label editor

Contents

Show the page label editor
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.

linkShow the page label editor

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

public void ShowPageLabelSettingsDialog(Android.Support.V4.App.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.CustomAppTheme);
    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 : Android.Support.V7.App.AppCompatActivity, Android.Arch.Lifecycle.IObserver
{
    public void PageLabelObserveOnComplete(Android.Support.V4.App.FragmentActivity 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 anwsers you need: Support

Contents

Show the page label editor