---
title: "Create password-protected PDF on Android | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/android/document-security/add-a-password/"
md_url: "https://www.nutrient.io/guides/android/document-security/add-a-password.md"
last_updated: "2026-06-09T10:25:14.336Z"
description: "A PDF document can be encrypted to protect its contents from unauthorized access. for Nutrient Android SDK."
---

# Creating password-protected PDFs on Android

A PDF document can be encrypted to protect its contents from unauthorized access.

### KOTLIN

```kotlin

val task = PdfProcessorTask.fromDocument(document)

// Create default document save options.
var documentSaveOptions = document.getDefaultDocumentSaveOptions()
// This will create an encrypted password-protected document.
documentSaveOptions.password = "password"

// Use created save options when processing the document.
PdfProcessor.processDocumentAsync(task, outputFile, documentSaveOptions)

```

### JAVA

```java

final PdfProcessorTask task = PdfProcessorTask.fromDocument(document);

// Create default document save options.
DocumentSaveOptions documentSaveOptions = document.getDefaultDocumentSaveOptions();
// This will create an encrypted password-protected document.
documentSaveOptions.setPassword("password");

// Use created save options when processing the document.
PdfProcessor.processDocumentAsync(task, outputFile, documentSaveOptions);

```
---

## Related pages

- [Encrypt PDFs with AES on Android](/guides/android/security/aesdataprovider.md)
- [Decrypt PDFs with AES on Android](/guides/android/document-security/decrypt-aes-files.md)
- [Secure your PDFs with custom watermarks on Android](/guides/android/document-security/add-a-watermark.md)
- [Document security on Android](/guides/android/document-security.md)
- [Introduction to PDF encryption on Android](/guides/android/security/introduction-to-encryption.md)
- [Prevent sharing of PDF files on Android](/guides/android/document-security/prevent-sharing.md)
- [Manage PDF document permissions on Android](/guides/android/features/document-permissions.md)

