> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/xamarin/guides/viewer-components/page-label-editor-a.md).

# Page label editor: add or modify PDF pages in Xamarin

Learn how to use PageLabelDialogFragment in Xamarin.Android to manage page labels in PDF documents. Follow this tutorial for step-by-step instructions. The Apryse Xamarin SDK streamlines secure, serve

{% hint style="info" %}
**This tutorial only applies to Xamarin.Android.**
{% endhint %}

The [`PageLabelDialogFragment`](https://sdk.apryse.com/api/xamarinandroid/tools/api/pdftron.PDF.Dialog.PageLabel.PageLabelDialog.html) 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.

![](https://653871032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgjsBtuYmcKhWOdM9VCg4%2Fuploads%2Fgit-blob-d4dc4d011e93991121aa9fad2e9c2a2c5cd221dc%2F45fbb90d9b77a3ff893cb92f02c01975e1d2d51e-600x1200.gif?alt=media)

## Show the page label editor

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

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
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");
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

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:

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
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);
                }
            }
        }
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/xamarin/guides/viewer-components/page-label-editor-a.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
