---
title: "Access to web APIs for MAUI PDF library | Nutrient"
canonical_url: "https://www.nutrient.io/guides/maui/advanced-access-apis/"
md_url: "https://www.nutrient.io/guides/maui/advanced-access-apis.md"
last_updated: "2026-05-23T00:08:18.135Z"
description: "Access to web s for MAUI PDF library | Nutrient API documentation for Nutrient MAUI SDK with methods, properties, and code examples."
---

# Advanced access to APIs

The APIs for Nutrient MAUI SDK are identical to the APIs for Nutrient Web SDK. This guide will discuss how to access Nutrient Web SDKs APIs from your MAUI application so that you can take advantage of all the functionalities of our Web SDK.

## Preparing a project for advanced access

1. Create a JavaScript asset file and add it to the `Raw/Assets` folder of your project — for example, `advanceAccess.js`.

2. When initializing [`PDFView`](https://www.nutrient.io/api/maui/sdk/PSPDFKit.Sdk.PDFView.html) in XAML, add the path to the JavaScript asset file to the `AdvanceAccessScriptPath` property:

```xml

<pspdfkit:PDFView x:Name="PDFView" AdvanceAccessScriptPath="advanceAccess.js".../>

```

## Accessing APIs

There are two main types of Web SDK APIs you can use.

### Adding a viewer configuration

To add a configuration that will be used to initialize the viewer, you can add a constant named `advanceConfiguration` to the `advanceAccess.js` file. For example:

```js

const advanceConfiguration = {
	enableHistory: true,
	disableMultiSelection: true,
	preventTextCopy: true,
};

```

You can find all the configurations available in the `configuration` class of the Web SDK [here](https://www.nutrient.io/api/web/PSPDFKit.Configuration.html).

### Accessing APIs available in the instance class

To access the APIs available in the [`Instance`](https://www.nutrient.io/api/web/PSPDFKit.Instance.html) class of Web, first access the object of the [`Instance`](https://www.nutrient.io/api/web/PSPDFKit.Instance.html) class for the current document using `PSPDFKit.Maui.MauiBridge.currentDocument`. Then, for example, if you want to remove the export PDF button from the main toolbar using the `setToolbarItems` method, use the following code:

```js

function removeExportButton() {
	const currentDocument = PSPDFKit.Maui.MauiBridge.currentDocument;
	const items = currentDocument.toolbarItems;
	currentDocument.setToolbarItems(
		items.filter((item) => item.type!== 'export-pdf'),
	);
}

```

To call this function from C# on a button click, use the following code:

```csharp

private async void OnRemoveExportDocumentButtonClicked(object sender, EventArgs e)
{
	await PDFView.Controller.ExecuteJavaScriptFunctionAsync("removeExportButton", new object[] { });
}

```

There’s an example of advanced access to APIs in our Catalog app’s [Advanced API Access](https://github.com/PSPDFKit/pspdfkit-maui-catalog/blob/main/Examples/Views/AdvanceAPIAccess.xaml.cs) example. For additional questions, [get in touch](https://www.nutrient.io/contact-sales) with us.

### Subscribing to events

Refer to the [Auto Save](https://github.com/PSPDFKit/pspdfkit-maui-catalog/blob/main/Examples/Views/AutoSave.xaml.cs) example from our Catalog app, which demonstrates how to subscribe to a Web SDK event and get notified in the C# code when the event is fired. In this specific example, we subscribe to the `document.saveStateChange` event from our web SDK to automatically save the file to the original destination.

To achieve this, we create an object of [`NutrientEventHandler`](https://github.com/PSPDFKit/pspdfkit-maui-catalog/blob/main/Examples/Services/NutrientEventHandler.cs), wrap it into a `DotNetObjectReference`, and inject it into the JavaScript layer using the [`IController.ExecuteJavaScriptFunctionAsync`](https://www.nutrient.io/api/maui/api/PSPDFKit.Api.IController.html#PSPDFKit_Api_IController_ExecuteJavaScriptFunctionAsync_System_String_System_Object___) API:

```csharp

var handler = DotNetObjectReference.Create(nutrientEventHandler);
await PSPDFKitController.ExecuteJavaScriptFunctionAsync("subscribe", new object[] { handler });

```

This object reference is then used to call the C# method `DetectedUnsavedChangesFromWeb` using the [`invokeMethodAsync`](https://github.com/PSPDFKit/pspdfkit-maui-catalog/blob/main/Resources/Raw/Assets/autoSave.js) method:

```js

function subscribe(nutrientEventHandler) {
	const currentDocument = PSPDFKit.Maui.MauiBridge.currentDocument;
	currentDocument.addEventListener(
		'document.saveStateChange',
		(event) => {
			if (!event.hasUnsavedChanges) {
				nutrientEventHandler.invokeMethodAsync(
					'detectedUnsavedChanges',
				);
			}
		},
	);
}

```

While calling the C# method from JavaScript, we use the name provided to the `JSInvokable` attribute — i.e. `detectedUnsavedChanges` — instead of the C# method name `DetectedUnsavedChangesFromWeb`.

In conclusion, bridging APIs and events from Nutrient Web SDK with a.NET MAUI application provides developers with access to a wide range of advanced functionalities. By subscribing to specific events and utilizing methods like `DotNetObjectReference` and `invokeMethodAsync`, you can create a seamless interaction between the web and native layers. This integration not only automates tasks such as saving changes, but it also enhances the overall user experience by ensuring the application remains responsive and efficient.
---

## Related pages

- [AI Assistant](/guides/maui/ai-assistant.md)
- [PDF bookmarks in MAUI](/guides/maui/bookmarks.md)
- [Changelog for .NET MAUI](/guides/maui/changelog.md)
- [Demo: MAUI PDF library](/guides/maui/demo.md)
- [Compare PDF files in MAUI](/guides/maui/comparison.md)
- [Download our MAUI library](/guides/maui/downloads.md)
- [PDF document security in MAUI](/guides/maui/document-security.md)
- [MAUI PDF form library](/guides/maui/forms.md)
- [Edit PDFs in MAUI](/guides/maui/editor.md)
- [MAUI PDF library](/guides/maui.md)
- [Nutrient guides: Integrate our PDF library](/guides/maui/intro.md)
- [MAUI PDF generation library](/guides/maui/pdf-generation.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)

