Get started with Apryse WebViewer SDK in a JavaScript app via manual install
This guide shows how to manually integrate the WebViewer SDK into a web project without using a package manager. 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.
Interact with our showcase demo to test out all of the Apryse WebViewer SDK functionality.
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.
Create a new folder for your project by running the following command in your terminal:
Shell
1mkdir webviewer-manual-integration
2
2. Move into the project folder so you can start working in it:
Shell
1cd webviewer-manual-integration
2
2. Download WebViewer
In this step, you’ll 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 folder should look like this:
Text
1webviewer-manual-integration/
2└── WebViewer/
3 ├── doc/
4 ├── lib/
5 ├── licenses/
6 ├── samples/
7 ├── scripts/
8 ├── package.json
9 └── server.js
3. Set up WebViewer
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.
Open the index.html file and add the following HTML to it:
Set the path to the location of webviewer.min.js in your project.
Replace YOUR_LICENSE_KEY with your license key. If you're signed in with an Apryse account, your license key is automatically prepopulated.
Use initialDoc to define the document to load on startup.
Provide the ID of the HTML element where WebViewer should be mounted (in this example, viewer).
Info
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: