Open Documents from Document Engine

To load a document from the Document Engine backend when using PSPDFKit for Web 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 PSPDFKit Instant should be enabled. PSPDFKit Instant is a real-time collaboration platform that enables your users to annotate documents simultaneously using PSPDFKit 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.

Password prompt shown for the password protected document.

Loading Options

You can open files in any of the supported file formats.

PSPDFKit.load() also accepts different configuration options:

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
  })
})