Adding to Your Project

This guide will walk you through adding PSPDFKit for Web to your project for standalone deployment.

Accessing license information — for evaluation

After requesting an evaluation license, follow the PSPDFKit for Web trial link in the email you received. This will automatically fill in the license information in the following examples on this page.

Accessing license information — for existing customers

  1. In your web browser, log in to https://customers.pspdfkit.com and navigate to the Your Licenses & Keys page.
  2. Locate your PSPDFKit for Web license and click Download PSPDFKit for Web to see all the download options.
  3. Depending on how you want to install the package, follow the instructions from either the Manual Download or Install with npm sections below.

Manual Download

If you want to add PSPDFKit for Web manually, select the Download tab in the download dialog of the al and click on the download button. Download the framework here.

The download will start immediately and will save a zip archive like PSPDFKit-Web-binary-2017.9.0.zip to your computer.

Once the download is complete, extract the archive and copy the entire contents of its dist folder to your project’s folder.

Install with npm

PSPDFKit for Web can also be installed as an npm package. The package is securely hosted on our servers as a tarball, and its URL is unique to each customer and license. For each license, we generate an NPM_KEY, which is what makes a download link work.

Copy
1
2
3
<p class="hide-in-trial">
  To install the npm package, simply follow the instructions from the Install with npm tab in the download dialog of the <a href="https://customers.pspdfkit.com/" rel="nofollow">al</a> — the tarball URL already includes your <strong>NPM_KEY</strong>.
</p>

Always use the latest release:

1
yarn add https://customers.pspdfkit.com/npm/YOUR_NPM_KEY_GOES_HERE/latest.tar.gz
1
npm install --save https://customers.pspdfkit.com/npm/YOUR_NPM_KEY_GOES_HERE/latest.tar.gz

Note that when installing the latest version, you always get the most recent release, so expect a hash mismatch when a new version of PSPDFKit for Web is released.

Installing latest is similar to having "pspdfkit": "*" in your package.json.

Pinning to a specific version (e.g. 2018.2.0):

1
yarn add https://customers.pspdfkit.com/npm/YOUR_NPM_KEY_GOES_HERE/2018.2.0.tar.gz
1
npm install --save https://customers.pspdfkit.com/npm/YOUR_NPM_KEY_GOES_HERE/2018.2.0.tar.gz

This will add a dependency with the name pspdfkit to your application’s package.json.

Copy the PSPDFKit for Web Assets

In order for PSPDFKit for Web to work, you will need to copy all the library files (artifacts) — except for pspdfkit.js — from node_modules/pspdfkit/dist to your project folder and serve them from the same folder of your application module that requires pspdfkit.

For example, let’s assume that pspdfkit is required in the main application file, src/index.js:

1
2
3
4
// src/index.js
import PSPDFKit from 'pspdfkit';

PSPDFKit.load(...);
1
2
3
4
// src/index.js
var PSPDFKit = require('pspdfkit');

PSPDFKit.load(...);

The application is built into a ./dist folder, so the PSPDFKit for Web artifacts must be copied to the same dist folder:

1
cp -R ./node_modules/pspdfkit/dist/pspdfkit-lib ./dist

We highly recommend using a tool or module bundler like webpack to automate this process.

Using Angular? See here for information on integration.

Next Up: Integrating PSPDFKit for Web

In fact, you may want to check out our sample application built with webpack.