Integrating sync and collaboration into your JavaScript application
Instant sync and collaboration is available when using Web SDK with Document Engine. For more information, refer to the operational mode guide.
NutrientViewer.load({ authPayload: { jwt: "xxx.xxx.xxx" }, container: ".foo", documentId: "85203", instant: true}) .then((instance) => { console.log("Successfully mounted PSPDFKit", instance); }) .catch((error) => { console.error(error.message); });Prerequisites
To use Instant sync, you need:
- Instant component enabled in your license (all features are enabled during trials)
- Document Engine as your central server for real-time syncing
- Web viewer integrated with Document Engine
- Instant flag enabled when displaying your document
Instant sync isn't available in standalone mode — Document Engine is required.
Permissions
If you have the Collaboration Permissions license feature enabled, you also have access to a granular permission system, which allows you to control what each user can see and do. To use it, you have to include the collaboration_permissions and user_id properties in your JSON Web Token (JWT).
Here's how this might look:
const token = { ...otherProperties, collaboration_permissions: [ "annotations:view:all", "annotations:edit:all" ], user_id: "user-12345"};The presence of collaboration_permissions and user_id is mandatory for enabling Collaboration Permissions.
If the Collaboration Permissions feature is enabled, all its associated actions are disabled unless you manually allow them. For example, collaboration_permissions: [] means users won't be able to view any annotation, comment, or form field on a PDF. If collaboration_permissions isn't present in the JWT, then Collaboration Permissions will automatically be disabled, and users will be able to perform every action without any restriction.
In the code mentioned above, you can see that collaboration_permissions is an array of permission strings. The permission strings define the permissions that have been granted to the user. Each string consists of three parts written in the <content-type>:<action>:<scope> format. You can learn more about different possible values of content type, action, and scope in the Defining Permissions guide.