---
title: "MAUI PDF SDK security: Secure documents on MAUI | Nutrient"
canonical_url: "https://www.nutrient.io/guides/maui/document-security/"
md_url: "https://www.nutrient.io/guides/maui/document-security.md"
last_updated: "2026-05-15T19:10:05.048Z"
description: "Nutrient MAUI SDK offers developers control over document security when documents are displayed in the viewer."
---

# PDF document security in MAUI

Nutrient MAUI SDK offers developers control over document security when documents are displayed in the viewer.

## Preventing printing

It’s possible to enable or disable printing using the [`IsDisabled`](https://www.nutrient.io/api/maui/sdk/PSPDFKit.Sdk.Models.Toolbar.Base.MainToolbarButtonBase.html#PSPDFKit_Sdk_Models_Toolbar_Base_MainToolbarButtonBase_IsDisabled) property of the `PrintButton` object:

```csharp

var printButton = (PrintButton)PSPDFKitController.MainToolbar.
   ToolbarItems.Single(item => item is PrintButton);
printButton.IsDisabled = true;

```

To remove the print button from the toolbar, use the following code:

```csharp

var printButton = PSPDFKitController.MainToolbar.ToolbarItems.First(
    item => item.GetType() == typeof(PrintButton));

PSPDFKitController.MainToolbar.ToolbarItems.Remove(printButton);

```

## Preventing exporting

You can prevent a user from using the export toolbar item to export PDFs by omitting it from the list of toolbar items:

```csharp

var exportPDFButton = PSPDFKitController.MainToolbar.ToolbarItems.First(
    item => item.GetType() == typeof(ExportPDFButton));

PSPDFKitController.MainToolbar.ToolbarItems.Remove(exportPDFButton);

```

## Protecting PDFs with a password

To create a password-protected PDF from a document, follow these steps:

1. [Load the source document](https://www.nutrient.io/guides/maui/open-a-document.md).

2. Use the `ExportDocumentAsync` method to convert the source document to a password-protected PDF. This method takes `IExportConfiguration` as its parameter, which configures the conversion. For conversion to a password-protected PDF, update the `Permissions` object that you pass to the export method.
   - `UserPassword` takes a string value that specifies the user password. Users might have limited access to the document depending on how you configure user permissions with the `PermissionFlags` parameter.
   - `OwnerPassword` takes a string value that specifies the owner password. Owners have full access to the document.
   - `PermissionFlags` specifies what users can do with the document. For more information on setting user permissions, see [Setting User Permissions](#setting-user-permissions) below.

3. Save the output document. The export method returns a `byte[]` that contains the output PDF document. You can then save the output PDF to a desired location. For more information on exporting documents, refer to the [guides on saving a document](https://www.nutrient.io/guides/maui/save-a-document.md).

The example below loads a PDF document and exports it to a PDF that can only be opened with the user password, and users can only view the document:

```csharp

var document = await PDFView.Controller.LoadDocumentAsync("source.pdf", PDFView.Controller.CreateViewerConfiguration());

var exportConfiguration = document.CreateExportConfiguration();
exportConfiguration.Permissions.UserPassword = "u$erp@ssw0rd";
exportConfiguration.Permissions.OwnerPassword = "u$ownerp@ssw0rd";

var outputDocument = await document.ExportDocumentAsync(exportConfiguration);

```

### Setting user permissions

Specify what users can do to a password-protected document with the `PermissionFlags` property. Using this flag, you can set the following permissions:

- `AnnotationsAndForms` allows users to add or modify text annotations and fill in interactive form fields.

- `Assemble` allows users to insert, rotate, or delete pages and create document outline items or thumbnail images.

- `Extract` allows users to copy or otherwise extract text and graphics from the document.

- `ExtractAccessibility` allows users to copy or otherwise extract text and graphics from the document using accessibility options.

- `FillForms` allows users to fill in existing interactive form fields (including signature fields).

- `Modification` allows users to modify the document in any way not covered by the other permissions settings.

- `PrintHighQuality` allows users to print the document in high quality.

- `Printing` allows users to print the document.
---

## Related pages

- [PDF bookmarks in MAUI](/guides/maui/bookmarks.md)
- [Advanced access to APIs](/guides/maui/advanced-access-apis.md)
- [AI Assistant](/guides/maui/ai-assistant.md)
- [Changelog for .NET MAUI](/guides/maui/changelog.md)
- [Compare PDF files in MAUI](/guides/maui/comparison.md)
- [Demo: MAUI PDF library](/guides/maui/demo.md)
- [Download our MAUI library](/guides/maui/downloads.md)
- [Edit PDFs in MAUI](/guides/maui/editor.md)
- [MAUI PDF form library](/guides/maui/forms.md)
- [MAUI PDF library](/guides/maui.md)
- [Nutrient guides: Integrate our PDF library](/guides/maui/intro.md)
- [Printing a PDF in MAUI](/guides/maui/print.md)
- [Redact PDF files in MAUI](/guides/maui/redaction.md)
- [MAUI PDF generation library](/guides/maui/pdf-generation.md)
- [PDF text search in MAUI](/guides/maui/search.md)
- [Troubleshooting](/guides/maui/troubleshoot.md)
- [Upgrade and migration guides](/guides/maui/upgrade.md)

