---
title: "Flatten PDF form fields on Android | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/android/forms/flatten/"
md_url: "https://www.nutrient.io/guides/android/forms/flatten.md"
last_updated: "2026-05-20T19:49:34.711Z"
description: "Nutrient allows form flattening using the PdfProcessor class."
---

# Flatten PDF form fields on Android

Nutrient allows form flattening using the [`PdfProcessor`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.processor/-pdf-processor/index.html) class.

> **❗Important:** When using the processor API before loading a document, you must ensure Nutrient is fully initialized, or processing will fail. Check out our [integrating Nutrient](https://www.nutrient.io/sdk/android/getting-started.md) guide for more information.

Form elements are of a special annotation type, [`AnnotationType::WIDGET`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.annotations/-annotation-type/index.html), so first see our guide on [flattening annotations](https://www.nutrient.io/guides/android/annotations/flatten.md), which also covers flattening for printing. You can use the method discussed there to flatten all types of form elements:

### KOTLIN

```kotlin

// Flatten only forms, and copy everything else.
val task = PdfProcessorTask.fromDocument(document).changeAllAnnotations(PdfProcessorTask.AnnotationProcessingMode.KEEP).changeAnnotationsOfType(AnnotationType.WIDGET, PdfProcessorTask.AnnotationProcessingMode.FLATTEN)
PdfProcessor.processDocumentAsync(task,...)

```

### JAVA

```java

// Flatten only forms, and copy everything else.
PdfProcessorTask task = PdfProcessorTask.fromDocument(document).changeAllAnnotations(PdfProcessorTask.AnnotationProcessingMode.KEEP).changeAnnotationsOfType(AnnotationType.WIDGET, PdfProcessorTask.AnnotationProcessingMode.FLATTEN);
PdfProcessor.processDocumentAsync(task,...);

```

If you want to flatten only form elements of a specific [`FormType`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.forms/-form-type/index.html), you can use [`PdfProcessorTask#changeFormsOfType`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.document.processor/-pdf-processor-task/change-forms-of-type.html) instead.

For example, you might not want to flatten a signature annotation, as only the visual representation of the digital signature — and not the actual digital signature — would be included in the resulting document:

### KOTLIN

```kotlin

// Flatten all forms except for signature types.
val task = PdfProcessorTask.fromDocument(document).changeAnnotationsOfType(AnnotationType.WIDGET, PdfProcessorTask.AnnotationProcessingMode.FLATTEN).changeFormsOfType(FormType.SIGNATURE, PdfProcessorTask.AnnotationProcessingMode.KEEP)
PdfProcessor.processDocument(task,...)

```

### JAVA

```java

// Flatten all forms except for signature types.
PdfProcessorTask task = PdfProcessorTask.fromDocument(document).changeAnnotationsOfType(AnnotationType.WIDGET, PdfProcessorTask.AnnotationProcessingMode.FLATTEN).changeFormsOfType(FormType.SIGNATURE, PdfProcessorTask.AnnotationProcessingMode.KEEP);
PdfProcessor.processDocumentAsync(task,...);

```
---

## Related pages

- [Easy steps to extract PDF form data on Android](/guides/android/forms/extract-form-data.md)
- [PDF form library for Android](/guides/android/forms.md)
- [Explore flexible PDF form actions on Android](/guides/android/forms/pdf-actions-support.md)
- [Validate PDF forms on Android with JavaScript](/guides/android/forms/javascript-validation.md)

