Advance Access to APIs

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

Preparing a Project for Advance 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 in XAML, add the path to the JavaScript asset file to the AdvanceAccessScriptPath property:

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

Accessing APIs

There are two main types of PSPDFKit for Web 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:

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

You can find all the configurations available in the configuration class of the Web SDK here.

Accessing APIs Available in the Instance Class

To access the APIs available in the Instance class of Web in standalone mode, first access the object of the Instance 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:

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

You can find an example of advanced access to APIs in our Catalog app’s Advance API Access example. For additional questions, please get in touch with us.