Example Projects

PSPDFKit for Web comes with two example projects — one written in Node.js, and another one in Ruby on Rails — to demonstrate how to integrate server-backed deployment. Furthermore, we provide an example of how to use Webpack to build a project that uses PSPDFKit for Web Standalone.

We currently don’t provide example applications for other languages (ASP.NET, PHP, Python, etc.). You can look into our existing examples and use the guides to build your own integration.


Node.js or Ruby on Rails (Server-Backed Deployment)

This example shows how to integrate PSPDFKit for Web into a Node.js or Ruby on Rails app.

The Node.js example uses the Express web framework to handle routing and jsonwebtoken to build the JSON Web Token (JWT). The Ruby on Rails example uses ruby-jwt to build the JWT.

Both the examples include the PSPDFKit bundle in the head via the script tag. However, you can also use the PSPDFKit npm package with a module bundler, like in the standalone examples.

These steps show how to get the example apps, as well as PSPDFKit Server, up and running using Docker and Docker Compose. You can refer to the README of the individual examples for instructions on starting them outside of Docker.

  1. Make sure you have Docker installed and running.

    On macOS, we recommend the most recent version of Docker for Mac.

    On Windows, we recommend the most recent version of Docker for Windows.

  2. Log in to the private PSPDFKit Docker registry:

    Copy
    1
    2
    
    docker login -u YOUR_DOCKER_USERNAME_GOES_HERE -p YOUR_DOCKER_PASSWORD_GOES_HERE docker.pspdfkit.com
    docker pull docker.pspdfkit.com/pspdfkit:latest
    
  3. Get one of our example apps.

    The examples provide a docker-compose.yml file and a Dockerfile that will work without additional configuration:



  4. Run the container:

    1
    
    ACTIVATION_KEY=YOUR_ACTIVATION_KEY_GOES_HERE docker-compose up
    

    For comprehensive instructions on how to install and run the example projects, please refer to the README in the repos.


React App (Standalone Deployment)

This is an example project for PSPDFKit for Web demonstrating how to embed it into a React app bootstrapped with Create React App. It shows how to install the PSPDFKit package with npm or yarn and consume it in your host application.

View and download the source code on GitHub.

The README in the repository will guide you through the setup steps.


Webpack (Standalone Deployment)

This example shows how to integrate PSPDFKit for Web Standalone into a JavaScript application and how to build it with webpack.

View and download the source code on GitHub.

Prerequisites

Please refer to our Adding to Your Project guide for further information on how to obtain an npm and license key.

To install and run the examples, please refer to the README in the repository.