Example Projects
PSPDFKit Server comes with two example projects — one written in Ruby on Rails, and one written in Node.js — to demonstrate how to integrate PSPDFKit Server with your own backend.
If you’re looking into PSPDFKit for Web and need an activation key, we recommend referring to the Setting Up PSPDFKit Server guide for Server-backed deployment instead.
Once you’re ready to integrate with your own backend, you can set up an instance of PSPDFKit Server using our Deployment guide, which shows you the necessary docker-compose.yml
file in detail.
-
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.
You can use any OS supported by Docker, including popular Linux distributions like Ubuntu, Debian, Fedora, Red Hat, or CentOS.
Review our Docker guide to learn about all installation options. Reboot after installing Docker.
Verify that Docker works via typing
docker info
into a terminal. Ensure that the output includesOSType: linux
. If this is missing, revisit the installation instructions. PSPDFKit Server is a Linux-based Docker container and requires a Docker environment capable of running Linux containers. -
Pull the
pspdfkit
image from Docker Hub:1
docker pull pspdfkit/pspdfkit
-
Get one of our example apps.
The examples provide
docker-compose.yml
andDockerfile
files that will work without additional configuration:To clone the example to your machine and switch to its directory, run the following commands:
1 2
git clone https://github.com/PSPDFKit/pspdfkit-server-example-nodejs.git cd pspdfkit-server-example-nodejs
1 2
git clone https://github.com/PSPDFKit/pspdfkit-server-example-rails.git cd pspdfkit-server-example-rails
ℹ️ Note: If this command doesn’t work, you might need to install Git first.
-
Run the example:
1
ACTIVATION_KEY=YOUR_ACTIVATION_KEY_GOES_HERE docker-compose up
1 2
set ACTIVATION_KEY=YOUR_ACTIVATION_KEY_GOES_HERE docker-compose up
1 2
$env:ACTIVATION_KEY='YOUR_ACTIVATION_KEY_GOES_HERE' docker-compose up
You only have to provide the activation key once. After doing so, the server will remain activated until you reset it.
The example app is now running on http://localhost:3000. It will prompt for a username, but you can enter anything to proceed.
You can also access PSPDFKit Server’s dashboard at http://localhost:5000/dashboard with the username
dashboard
and the passwordsecret
.You can quit the running containers with Ctrl + C.
If you want to test PSPDFKit for Web on different devices in your local network, you need to edit the
PSPDFKIT_SERVER_EXTERNAL_URL
environment variable in thedocker-compose.yml
file and set it to an address that’s reachable from your device.
⚠️ Warning: If you get an error, you might need to install
docker-compose
separately. If the message is the “ERROR: Couldn’t connect to Docker daemon at http+docker://localunixsocket - is it running?” warning under Linux, check withdocker info
to see if the service is running. You might need to usesudo
for the compose command.