PSPDFKit Instant Usage on React Native
To use Instant for React Native, use the Pspdfkit.presentInstant()
method with the server’s URL and JSON Web Token (JWT) as its parameters. This will load the Instant document from a viewer.
The JWT should contain the following information:
-
Document ID — A unique document identifier that you want to view and collaborate on.
-
User information — The user name, email address, and other relevant details.
-
Permissions — What actions the user is allowed to perform on the document (viewing, annotating, or commenting).
-
Instant layers — Collaborative layers that will be used for the Instant document viewer.
Here’s an example of how to use the Pspdfkit.presentInstant()
method in a React Native app:
import { NativeModules } from 'react-native'; const PSPDFKit = NativeModules.PSPDFKit; // Assume that the `serverUrl` and `jwt` parameters were downloaded in the previous step. // As a result, you'll have an object like: const documentData = { jwt: '[jwt authToken]', serverUrl: '[webserverUrl]', }; // Present the Instant document viewer by providing the `documentData` object. PSPDFKit.presentInstant(documentData);
You can also pass additional configuration
options to the Pspdfkit.presentInstant()
method to customize the behavior of the Instant document viewer.