Open Documents from Document Engine
To load a document from the Document Engine backend when using Nutrient Web SDK in server-backed operational mode, pass the document’s ID, the JSON Web Token (JWT) for authentication, and information as to whether or not PSPDFKit Instant should be enabled in the configuration object passed to PSPDFKit.load()
:
PSPDFKit.load({ documentId: "<document_id>", authPayload: { jwt: "<jwt>" }, instant: true });
The <document_id>
placeholder in the code above should be replaced by the identifier of an existing document on Document Engine. See the Document Engine documentation for information on how to upload documents.
The <jwt>
placeholder should be replaced with a valid and signed JWT. See the Generate a JWT guide for details.
The instant
option configures whether or not Nutrient Instant should be enabled. Nutrient Instant is a real-time collaboration platform that enables your users to annotate documents simultaneously using Nutrient across iOS, Android, Flutter, React Native, and their browser.
Accessing a password-protected document
To load password-protected PDFs, you can provide the password
option in the configuration.
Alternatively, clients can access password-protected PDFs by using a JWT that includes the password
claim, or by supplying the password when opening or loading a document.
If the password is neither included in the JWT nor set via the configuration, the user will be asked to enter the password via a password prompt.
Loading options
You can open files in any of the supported file formats.
PSPDFKit.load()
also accepts different configuration options:
-
authPayload
(Server only) -
documentId
(Server only) -
instant
(Server only)
Example:
PSPDFKit.load({ container, documentId, authPayload: { jwt: "<jwt>" }, instant: true, toolbarItems: PSPDFKit.defaultToolbarItems.filter(item => item.type !== "print"), initialViewState: new PSPDFKit.ViewState({ sidebarMode: PSPDFKit.SidebarMode.THUMBNAILS }) })