> 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/android/page-manipulation/page-label-editor-a.md).

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

Discover how to add or modify page labels in a PDF document with PageLabelDialogFragment. Learn how to customize page numbering and labels for a seamless reading experience. Subscribe to completion ev

The [`PageLabelDialogFragment`](https://sdk.apryse.com/api/android/javadoc/reference/com/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://226546913-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0QItsdFBmuuL9ezHimHy%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="Java" %}
{% code lineNumbers="true" %}

```java
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.PDFTronAppTheme);
    dialog.show(fragmentManager, PageLabelDialog.TAG);
}
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
fun showPageLabelSettingsDialog(fragmentManager: FragmentManager, fromPage: Int, toPage: Int, pageCount: Int) {
    val dialog = PageLabelDialog.newInstance(fromPage, toPage, pageCount)
    dialog.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.PDFTronAppTheme)
    dialog.show(fragmentManager, PageLabelDialog.TAG)
}
```

{% 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="Java" %}
{% code lineNumbers="true" %}

```java
public void observeOnComplete(final AppCompatActivity 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());
            }
        }
    });
}
```

{% endcode %}
{% endtab %}

{% tab title="Kotlin" %}
{% code lineNumbers="true" %}

```kotlin
fun observeOnComplete(activity: AppCompatActivity, pdfViewCtrl: PDFViewCtrl) {
    val viewModel = ViewModelProviders.of(activity).get(PageLabelSettingViewModel::class.java)
    viewModel.observeOnComplete(activity, Observer { 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.contentIfNotHandled!!)
        }
    })
}
```

{% 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.apryse.com/android/page-manipulation/page-label-editor-a.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
