Build a JavaScript PDF viewer with Apryse WebViewer SDK using a manual setup
This guide shows how to manually integrate the Apryse WebViewer SDK into a web project without using a package manager or bundler. The approach is useful when you need full control over asset hosting, or when npm or CDN-based setups aren’t an option. The examples use a simple HTML‑based project to focus on the core integration steps. By the end, you’ll successfully initialize WebViewer and render a PDF document in the UI.
You can also download our ready-to-use GitHub samples to get started quickly, or explore the interactive Showcase demo to see WebViewer's full capabilities in action.
Prerequisites
Before you start:
Install Node.js and npm. We recommend using the latest active LTS release.
Install Visual Studio Code or another code editor to develop and debug your code.
Get your Apryse trial key.
License Key
Apryse collects some data regarding your usage of the SDK for product improvement.
The data that Apryse collects include:
The names and number of API calls
The number of pages in a document
The version of the SDK
The language of the SDK
For clarity, no other data is collected by the SDK and Apryse has no access to the contents of your documents.
If you wish to continue without data collection, contact us and we will email you a no-tracking trial key for you to get started.
1. Create your project
Set up your project by creating a folder and preparing a workspace for your WebViewer application.
In your terminal, go to the directory where you want to create the project.
Create a new project folder and move to it so you can start working with it:
Shell
1mkdir webviewer-manual-integration
2cd webviewer-manual-integration
2. Download WebViewer
In this step, you’ll manually download the WebViewer package and add it to your project.
Download the WebViewer package, which includes the library files, samples, and documentation.
Extract the downloaded WebViewer.zip file into the webviewer-manual-integration project folder. Your project structure should look similar to this:
Text
1webviewer-manual-integration/
2└── WebViewer/
3 ├── doc/
4 ├── lib/
5 ├── licenses/
6 ├── samples/
7 ├── scripts/
8 ├── package.json
9 └── server.js
3. Create the PDF viewer
In this section, you'll create an HTML page for your WebViewer application, add the WebViewer script, define a container for the viewer, and initialize WebViewer so it can load and display a document.
Open the webviewer-manual-integration folder in Visual Studio Code.
Create a new index.html file in the webviewer-manual-integration folder.
This guide uses a <script> tag to load WebViewer. If you install the SDK manually, you can also use a hybrid approach and import WebViewer using ES module syntax with a bundler. For more, see Importing.
4. Add the following JavaScript to your index.html file, placing it after the <div id="viewer"> element and before the closing </body> tag:
JavaScript (SDK v10.2+)
index.html
1<script>
2 WebViewer({
3 // Add path to Apryse 'lib' folder on your server
4 path: 'WebViewer/lib',
5 // Replace with your license key, key signup at https://dev.apryse.com
6 licenseKey: 'YOUR_LICENSE_KEY',
7 // Specify an initial document to load on startup
If you're signed in with an Apryse account, your license key is automatically prepopulated in all code snippets.
Starting in version 11, WebViewer instantiates using a web component by default instead of an iframe. Both methods are still supported. See this guide for more information.
5. Save the index.html file.
4. Verify your output
Once your project files are in place, serve the webpage so that WebViewer can load its UI and display the PDF you added as the initial document in index.html. We use http-server to preview the page locally in your browser.
1. From your project directory, run the following command to start a local web server:
Shell
1npx http-server -a localhost
If prompted, press y to install http-server. A successful output looks similar to:
Shell
1Starting up http-server, serving ./public
2
3http-server version: 14.1.1
4
5http-server settings:
6CORS: disabled
7Cache: 3600 seconds
8Connection Timeout: 120 seconds
9Directory Listings: visible
10AutoIndex: visible
11Serve GZIP Files: false
12Serve Brotli Files: false
13Default File Extension: none
14
15Available on:
16 http://localhost:8080
2. Open the localhost URL from your terminal to view the WebViewer UI and PDF document.
Get started video
In this 5-minute video, learn how to manually install WebViewer in a simple HTML-based project without using npm or a package manager.
Manual installation showing how to integrate WebViewer without a package manager.