Nutrient

SDK

Cloud

Low-Code

Workflow

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

JavaScript
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, or through its API. Session tokens are used for authenticating Nutrient Web SDK clients when connecting to DWS Viewer API.

Note: 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 would use the document property.

Integration overview

To integrate with DWS Viewer API, you need to:

  1. 1

    Upload your document — First, upload your document to DWS and obtain the document ID

  2. 2

    Generate session token — Use the document ID to generate a session token

  3. 3

    Open 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 the Node.js integration example guide.

Refer to the following additional guides: