---
title: "Prevent sharing of PDF files on Android | Nutrient SDK"
canonical_url: "https://www.nutrient.io/guides/android/document-security/prevent-sharing/"
md_url: "https://www.nutrient.io/guides/android/document-security/prevent-sharing.md"
last_updated: "2026-05-30T02:20:01.153Z"
description: "Nutrient Android SDK enables you to customize the document sharing experience. To prevent your end users from sharing documents."
---

# Prevent sharing of PDF files on Android

Nutrient Android SDK enables you to customize the [document sharing experience](https://www.nutrient.io/guides/android/miscellaneous/document-sharing.md). To prevent your end users from sharing documents, you can either remove the default menu action, or use the [`setEnabledShareFeatures`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.configuration/-pdf-configuration/-builder/set-enabled-share-features.html) option when building your [`PdfActivityConfiguration`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.configuration.activity/-pdf-activity-configuration/index.html).

The latter option is the simplest:

### KOTLIN

```kotlin

configuration = PdfActivityConfiguration.Builder(configuration).setEnabledShareFeatures(ShareFeatures.none()).build()

```

### JAVA

```java

PdfActivityConfiguration configuration = configBuilder.setEnabledShareFeatures(ShareFeatures.none()).build();

```

Note that `setEnabledShareFeatures` uses the [`ShareFeatures`](https://www.nutrient.io/api/android/nutrient/com.pspdfkit.configuration.sharing/-share-features/index.html) `enum`, providing you with a granular approach if needed.

For even more control over the menus, the following snippet shows you how to remove sharing options during menu generation:

### KOTLIN

```kotlin

class CustomActivity : PdfActivity() {
    override fun onGenerateMenuItemIds(menuItems: MutableList<Int>): List<Int> {
        // Take the default menu item IDs and remove the outlined items.
        menuItems.remove(PdfActivity.MENU_OPTION_SHARE)

        // Return the new order for the menu items.
        return menuItems
    }
}

```

### JAVA

```java

public class CustomActivity extends PdfActivity {
    @Override
    public List<Integer> onGenerateMenuItemIds(@NonNull List<Integer> menuItems) {
        // Take the default menu item IDs and remove the outlined items.
        menuItems.remove(PdfActivity.MENU_OPTION_SHARE);

        // Return the new order for the menu items.
        return menuItems;
    }
}

```

More information on menu customization, such as menu options other than sharing, can be found in our [guide on customizing the main toolbar](https://www.nutrient.io/guides/android/customizing-the-interface/customizing-menus.md).
---

## Related pages

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

