Choose the right document opening and loading setup
Opening or loading a document follows the same high-level workflow across Nutrient Web SDK, Document Engine, and DWS Viewer API:
- Make the document available to the product you’re using.
- Get the identifier or credential the client needs.
- Load the document with the correct Web SDK configuration.
The same workflow in each setup
| Setup | What the client loads with | What happens before loading |
|---|---|---|
| Web SDK with a license key | document + licenseKey | Your app provides the document directly to Web SDK from a URL, path, Blob, ArrayBuffer, Base64 data, or another supported source. |
| Web SDK + Document Engine | documentId + authPayload.jwt | Your backend creates or references a document in Document Engine and generates a JWT for the client. |
| DWS Viewer API with DWS-managed documents | session | Your backend uploads or references a DWS-managed document and creates a document-bound session token. |
| DWS Viewer API with app-provided documents | session + document | Your backend creates a DWS Viewer API browser session, and your frontend passes the document directly to Web SDK. |
Minimal loading examples
For each setup, the client-side loading code is similar, but the parameters passed to NutrientViewer.load() differ based on the workflow.
Web SDK with a license key
NutrientViewer.load({ container: "#nutrient", document: "/path/to/document.pdf", licenseKey: "<license_key>",});Web SDK + Document Engine
NutrientViewer.load({ container: "#nutrient", documentId: "<document_id>", authPayload: { jwt: "<jwt>" }, instant: true,});DWS Viewer API with DWS-managed documents
NutrientViewer.load({ container: "#nutrient", session: "<session_token>",});DWS Viewer API with app-provided documents
NutrientViewer.load({ container: "#nutrient", session: "<session_token>", document: "/path/to/document.pdf",});How to choose the right flow
Use Web SDK with a license key when your app already controls document delivery and authorization and the browser can open the document directly.
Use Web SDK + Document Engine when you want your own self-hosted backend for document storage, streaming, permissions, synchronization, or collaboration.
Use DWS Viewer API with DWS-managed documents when you want Nutrient’s hosted service to store, stream, and manage documents for Web SDK.
Use DWS Viewer API with app-provided documents when your app or browser already has the document, but you want DWS Viewer API to authorize and meter the viewer session.
Common points of confusion
documentis the Web SDK option for documents provided by your app or browser.licenseKeyis used for licensed Web SDK deployments, but it’s omitted when a DWS Viewer API session authorizes the load.documentId+authPayload.jwtis the standard Document Engine-backed loading option.sessionis the DWS Viewer API loading option for DWS-managed documents.session+documentis the DWS Viewer API loading option for app-provided documents.- Uploading, creating, or referencing a server-managed document is a backend step; calling
NutrientViewer.load()is the client step.
Equivalent guides by product
- Web SDK
- Document Engine
- DWS Viewer API