Document Web Services Viewer API
Nutrient Document Web Services Viewer API is a service that integrates with Document Engine to support our Web SDK. It enables document rendering, processing, and storage in web applications.
This guide walks you through the steps to get started with DWS Viewer API. You’ll set up Nutrient Web SDK and use it to render a document using the DWS Viewer API.
See DWS Viewer API capabilities in the Nutrient dashboard.
Prefer to jump straight into code? View a detailed example that covers various capabilities of DWS APIs.
Setting up your DWS dashboard
Before you begin, sign up(opens in a new tab) for a free account in the Document Web Services (DWS) dashboard.
Create a new application in the DWS Viewer API dashboard(opens in a new tab).
Select the Documents tab and upload a test document to your application. You may download and use our sample PDF(opens in a new tab) for testing purposes.

You’ll see the uploaded document in the dashboard. Click the View button to open the document in the DWS dashboard.

You’re now ready to integrate DWS Viewer API using Nutrient Web SDK. You’ll use the session token for this document from the Copy Token button and render it using Nutrient Web SDK.
Session tokens generated from the DWS dashboard have a default expiry time of 24 hours. For production use cases, it’s recommended to generate a session token programmatically.
For this guide, you may continue using the token generated from the dashboard.
Setting up Nutrient Web SDK
You’ll use React and Vite to demonstrate the integration of Nutrient Web SDK with DWS Viewer API. However, you can use Nutrient Web SDK with any frontend framework of your choice.
You may also refer to the Web SDK getting started guide with React + Vite for a detailed walkthrough on setting up your React application with Nutrient Web SDK.
Installation
This guide uses the CDN installation to keep things simple.
Add the following
<script>tag in yourindex.htmlfile:index.html <!doctype html><html lang="en"><head><meta charset="UTF-8" /><link rel="icon" type="image/svg+xml" href="/vite.svg" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Vite + React + TS</title></head><body><div id="root"></div><script src="https://cdn.cloud.pspdfkit.com/pspdfkit-web@1.9.1/nutrient-viewer.js"></script><script type="module" src="/src/main.tsx"></script></body></html>You’re now ready to use Nutrient Web SDK and reference
window.NutrientViewerin the client-side code.
Rendering a PDF
Load the PDF file in
App.tsx. Pass the session token you copied from the DWS dashboard in thesessionproperty of the configuration object for theNutrientViewer.load()method:App.tsx import { useEffect, useRef } from "react";function App() {const containerRef = useRef(null);useEffect(() => {const container = containerRef.current;const { NutrientViewer } = window;if (container && NutrientViewer) {NutrientViewer.load({container,// Paste the session token you copied from the DWS dashboard here.session: "<Your session token>"});}return () => {NutrientViewer?.unload(container);};}, []);// Set the container height and width.return (<div ref={containerRef} style={{ height: "100vh", width: "100vw" }} />);}export default App;Start the development server:
You’ll see the PDF rendered in the Nutrient Web SDK user interface (UI), powered by DWS Viewer API. Try adding annotations or comments and they’ll be automatically persisted by DWS Viewer API with its out-of-box syncing capabilities.
Next steps
DWS Viewer API comes with various capabilities that you can explore further:
- It lets you upload and process documents directly from your application.
- For production use cases, generate a session token programmatically.
- Configure token settings such as expiry date, time, and editing permissions. For details, refer to the DWS API authentication guide.
For detailed instructions on integrating Nutrient Web SDK, check out our React + Vite guide.
See DWS Viewer API capabilities in the Nutrient Dashboard.
Follow a detailed tutorial that goes more in-depth on DWS Viewer and Processor API.