Open a document in Web SDK

To load a document from DWS Viewer API, pass the document’s session token for authentication in the configuration object passed to NutrientViewer.load():

Requirements

DWS Viewer API requires Nutrient Web SDK versions 1.1.1 or later.

Usage

NutrientViewer.load({
container: "<container>",
session: "<session_token>",
});

The <container> placeholder in the code above should be replaced by a CSS selector or a DOM element where Nutrient Web SDK will be mounted.

The <session_token> placeholder should be replaced by the session token obtained from the DWS Viewer API dashboard(opens in a new tab), or through its API. Session tokens are used for authenticating Nutrient Web SDK clients when connecting to DWS Viewer API.

When using DWS Viewer API, documents must be loaded using session tokens (not document URLs). Documents need to exist in DWS before you can generate session tokens for them and open them in Web SDK. This is different from loading local documents, where you’d use the document property.

Integration overview

To integrate with DWS Viewer API, you need to:

  1. Upload your document — First, upload your document to DWS and obtain the document ID.
  2. Generate a session token — Use the document ID to generate a session token.
  3. Open the document in Web SDK — Use the session token to open the document in Nutrient Web SDK.

For a complete server implementation example, refer to the Node.js integration example guide.

Refer to the following additional guides: