WebViewer is a powerful JavaScript-based PDF Library that is part of the Apryse SDK. It provides a slick out-of-the-box responsive UI that interacts with the core library to view, annotate and manipulate PDFs, MS Office, videos, images, and CAD that can be embedded into any web project.
This repo is specifically designed for any users interested in integrating WebViewer into a vanilla JS project.
You can explore all of the functionality in our showcase.
Before you begin, make sure your development environment includes Node.js and npm.
- Node.js.
- IDE used in this sample is Visual Studio Code with an NPM extension to process commands within its terminal.
- GitHub command line
git
.
git clone https://github.com/PDFTron/webviewer-js-sample.git
cd webviewer-js-sample
npm install
npm install
gets and installs required dependencies. Make sure .parcelrc
is available at the root and configured as below.
{
"extends": "@parcel/config-default",
"reporters": [
"...",
"parcel-reporter-multiple-static-file-copier"
]
}
npm start
After the app starts, you will be able to see a WebViewer running on localhost:1234
.
WebViewer
requires static resources created in the dist
folder. Make sure the origin
and destination
are specified as below in the package.json
.
"multipleStaticFileCopier": [
{
"origin": "node_modules/@pdftron/webviewer/public",
"destination": "dist/public/webviewer"
}
]
The package.json
file contains the start
and build
scripts. The only script to call is the start
to run the app out-of-the-box.
"start": "parcel index.html --open http://localhost:1234"
- @pdftron/webviewer API documentation
- @pdftron/webviewer-js-sample API documentation
- API documentation: WebViewerInstance.
Refer to a running sample on Apryse SDK showcase page.
For licensing, refer to License.