Integrate WebViewer JavaScript PDF Viewer & Editor into a Web App
This guide will show you how to get started with the WebViewer SDK through manual installation. By the end of this guide, you should be able load WebViewer into any app. This is the guide for you if you are looking to add WebViewer outside of a package manager.
Prerequisites
Prior to starting, you should have already installed Node and npm.
Downloads
WebViewer package (contains library and samples):
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.
Integrate into your application
1. Setup Local Server
To start, we need a server environment ready. If you do not have a server, follow these steps: * Create a folder for your project. This guide will assume your project is called myServer. * Open a terminal in that folder and execute:
sh
1```
2npm install -g http-server
3```
2. Extract WebViewer.zip
Extract the WebViewer package (WebViewer.zip) into your project directory (/myServer).
3. Create index.html
Create a new index.html webpage in the same project directory and paste this inside:
To import WebViewer as a CommonJS module, see this section.
4. Add Necessary Scripts
Next to instantiate WebViewer, add this script to the body after the viewer div declaration from the previous step. Add your own license key in place of 'YOUR_LICENSE_KEY'.:
Starting in version 10.2 you can choose to instantiate WebViewer using a web component instead of an iframe. See this guide for more information.
1<script>
2 WebViewer({
3 path: 'WebViewer/lib', // path to the Apryse 'lib' folder on your server
4 licenseKey: 'YOUR_LICENSE_KEY', // sign up to get a key at https://dev.apryse.com