---
title: "MAUI PDF generation library: Fast & accurate | Nutrient"
canonical_url: "https://www.nutrient.io/guides/maui/pdf-generation/"
md_url: "https://www.nutrient.io/guides/maui/pdf-generation.md"
last_updated: "2026-09-02T03:05:21.848Z"
description: "Nutrient MAUI SDK is a library for generating PDF documents in an app without using a server. Newly created PDFs can be rendered in our viewer."
---

# MAUI PDF generation library

Nutrient MAUI SDK is a library for generating PDF documents in an app without using a server. Newly created PDFs can be rendered in our viewer for signing, editing, form filling, and more.

## Generating a PDF with a PDF form

The following sections outline how to generate a PDF using a PDF form.

### Filling PDF form fields programmatically

Nutrient’s MAUI PDF library offers multiple options for filling form fields programmatically using the exposed JavaScript APIs, each with a different set of tradeoffs.

- XFDF — For exporting to or importing from other readers.

- Instant JSON — For the most efficient way to export or import changes made.

These APIs will be further enhanced and translated into native APIs in future updates.

For more information on filling PDF form fields programmatically using JavaScript APIs, refer to our [form filling](https://www.nutrient.io/guides/web/forms/form-filling.md) guide.

### Flattening form fields

The process of flattening form fields consists of rendering them over the background of a page with their current value and removing their data from the document.

For more information on flattening form fields, refer to our [flattening](https://www.nutrient.io/guides/maui/save-a-document/export-configuration.md#flatten) guide.

## Generating a PDF with images

To generate a PDF using images, follow the steps below.

1. While loading a document, you can pass an [asset path](https://www.nutrient.io/guides/maui/open-a-document/from-app-assets.md), a [local path](https://www.nutrient.io/guides/maui/open-a-document/from-local-storage.md), a [URL](https://www.nutrient.io/guides/maui/open-a-document/from-remote-url.md), a [byte array](https://www.nutrient.io/guides/maui/open-a-document/from-arraybuffer.md), or a [Base64 string](https://www.nutrient.io/guides/maui/open-a-document/from-base64-data.md) of an image into the loading function:

   ```csharp

   var documentFromAsset =
       await PSPDFKitController.LoadDocumentFromAssetsAsync(imageAssetPath, PSPDFKitController.CreateViewerConfiguration());

   var documentFromLocalStorage =
       await PSPDFKitController.LoadDocument(imagePath, PSPDFKitController.CreateViewerConfiguration());

   var documentFromBuffer =
       await PSPDFKitController.LoadDocumentFromBufferAsync(imageBuffer, PSPDFKitController.CreateViewerConfiguration());

   var documentFromBase64String =
       await PSPDFKitController.LoadDocumentFromBase64StringAsync(imageAsBase64String, PSPDFKitController.CreateViewerConfiguration());

   var documentFromRemoteUrl =
       await PSPDFKitController.LoadDocumentFromURLAsync(remoteImageURL, PSPDFKitController.CreateViewerConfiguration());
   ```

2. Optionally, make changes to the image. For example, [add an annotation](https://www.nutrient.io/guides/maui/annotations.md).

3. To export a loaded image as a PDF, use the `ExportDocumentAsync` function:

```csharp

var exportConfiguration = _document.CreateExportConfiguration();
var exportedDocumentAsPDF = await _document.ExportDocumentAsync(exportConfiguration);

```

When exporting a document, you have several options. Refer to our [export configuration](https://www.nutrient.io/guides/maui/save-a-document/export-configuration.md) guide for more details.

4. Save the output. The export method returns a byte array, which can be saved [to a file](https://www.nutrient.io/guides/maui/save-a-document/to-local-storage.md) or sent [to a server](https://www.nutrient.io/guides/maui/save-a-document/to-remote-server.md).
---

## Related pages

- [MAUI PDF library](/guides/maui.md)
- [Advanced access to APIs](/guides/maui/advanced-access-apis.md)
- [Agent skill](/guides/maui/agent-skill.md)
- [AI Assistant](/guides/maui/ai-assistant.md)
- [PDF bookmarks in MAUI](/guides/maui/bookmarks.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)
- [PDF document security in MAUI](/guides/maui/document-security.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)
- [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)
- [PDF text search in MAUI](/guides/maui/search.md)
- [Troubleshooting](/guides/maui/troubleshoot.md)
- [Upgrade and migration guides](/guides/maui/upgrade.md)

