---
title: "Remove pages from PDF file on Android | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/android/editor/page-manipulation/remove/"
md_url: "https://www.nutrient.io/guides/android/editor/page-manipulation/remove.md"
last_updated: "2026-06-19T09:21:00.185Z"
description: "Nutrient Android SDK lets you remove the pages of a document using the Processor API or the Document Editor API."
---

# Removing pages from a PDF on Android

Nutrient Android SDK lets you remove the pages of a document using the Processor API or the Document Editor API.

## Using the Processor API

To remove pages via the `PdfProcessor` API, load your document and then configure the parameters for page removal on a `PdfProcessorTask` instance. The Processor API is a great choice if you want to build an automated document processing operation:

### KOTLIN

```kotlin

// Create a `PdfProcessorTask` in which to store the operation.
val task = PdfProcessorTask.empty()
// Specify page indexes 1 and 3 for removal.
val pagesToRemove = setOf(1, 3)
task.removePages(pagesToRemove)

// Process to an output document.
val outputFile = File(context.filesDir, "outputDocument.pdf")
PdfProcessor.processDocument(task, outputFile)

```

### JAVA

```java

// Create a `PdfProcessorTask` in which to store the operation.
final PdfProcessorTask task = PdfProcessorTask.empty();
// Specify page indexes 1 and 3 for removal.
final HashSet<Integer> pagesToRemove = new HashSet<>();
pagesToRemove.add(1);
pagesToRemove.add(3);
task.removePages(pagesToRemove);

// Process to an output document.
final File outputFile = new File(context.getFilesDir(), "outputDocument.pdf");
PdfProcessor.processDocument(task, outputFile);

```

## Using the Document Editor API

Page removal is also available as part of the Document Editor API. The Document Editor API is particularly useful if you want to build a general-purpose UI for manipulating pages, as it provides helpers that make building a document editing UI easy.

Here’s how you can use the Document Editor API to remove the current page of a displayed document:

### KOTLIN

```kotlin

// Instance method on a `PdfActivity` subclass.
fun removePages() {
    // Use the `PdfDocumentEditorFactory` to create a `PdfDocumentEditor`.
    val documentEditor = PdfDocumentEditorFactory.createForDocument(document)

    // Set up the output file location.
    val outputFile = File(filesDir, "outputDocument.pdf")

    // Specify the current page for removal.
    val pagesToRemove = setOf(pageIndex)

    // Make sure `disposable` is managed by the activity and destroyed correctly
    // when the activity is destroyed.
    val disposable: Disposable = documentEditor.removePages(pagesToRemove).flatMapCompletable { documentEditor.saveDocument(context, outputFile.outputStream(), null) }
        // Use `subscribeOn` to put `saveDocument` on a background thread, as it can be slow..subscribeOn(Schedulers.io())
        // Make sure the resulting document rendering goes back on the main thread..observeOn(AndroidSchedulers.mainThread())
        // You can display the saved document in a new activity with the following action on `subscribe`..subscribe { showDocument(context, Uri.fromFile(outputFile), null) }
}

```

### JAVA

```java

// Instance method on a `PdfActivity` subclass.
public void removePages() {
    // Use the `PdfDocumentEditorFactory` to create a `PdfDocumentEditor`.
    final PdfDocumentEditor documentEditor =
        PdfDocumentEditorFactory.createForDocument(document);

    // Set up the output file location.
    final File outputFile = new File(getFilesDir(), "outputDocument.pdf");

    // Specify the current page for removal.
    final HashSet<Integer> pagesToRemove = new HashSet<>(Arrays.asList(getPageIndex()));

    // Make sure `disposable` is managed by the activity and destroyed correctly
    // when the activity is destroyed.
    final Disposable disposable = documentEditor.removePages(pagesToRemove).flatMapCompletable(saved -> documentEditor.saveDocument(context, new FileOutputStream(outputFile), null))
        // Use `subscribeOn` to put `saveDocument` on a background thread, as it can be slow..subscribeOn(Schedulers.io())
        // Make sure the resulting document rendering goes back on the main thread..observeOn(AndroidSchedulers.mainThread())
        // You can display the saved document in a new activity with the following action on `subscribe`..subscribe( () -> { PdfActivity.showDocument(context,
            Uri.fromFile(outputFile), null);
        });
}

```

## Using the built-in UI

Nutrient Android SDK comes with a prebuilt user interface for document editing that includes an option to remove pages. To learn more, check out the [Document Editor UI](https://www.nutrient.io/guides/ios/features/document-editor-ui.md) overview.
---

## Related pages

- [Cropping PDF pages on Android](/guides/android/editor/page-manipulation/crop.md)
- [Move or copy PDF pages on Android](/guides/android/editor/page-manipulation/move-or-copy.md)
- [Rotating PDF pages on Android](/guides/android/editor/page-manipulation/rotate.md)
- [Scale or resize PDFs on Android](/guides/android/editor/page-manipulation/scale-or-resize.md)

