Sample for PSPDFKit Server and Instant
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app
assets
bin
config
db
lib
log
public
tmp
.dockerignore
.gitignore
.tool-versions
Dockerfile
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
config.ru
docker-compose.yml
entrypoint.sh

README.md

PSPDFKit Server Example – Rails

This example shows how to integrate PSPDFKit Server and PSPDFKit for Web into a Rails app.

Note: This example demonstrates the usage of PSPDFKit for Web in a Rails application and is not optimized for production deployments. For information on how to set up PSPDFKit for Web in production, please refer to our guides instead.

Prerequisites

Getting Started with Docker

We recommend you use Docker to get all components up and running quickly.

The provided docker-compose.yml and Dockerfile will allow you to edit the example app on your host and it will live-reload.

$ git clone https://github.com/PSPDFKit/pspdfkit-server-example-rails.git
$ cd pspdfkit-server-example-rails
$ ACTIVATION_KEY=YOUR_ACTIVATION_KEY_GOES_HERE docker-compose up

If you are using Windows make sure to set the environment variables accordingly. For this replace the line starting with PSPDFKIT_ACTIVATION_KEY="... with:

$ SET "PSPDFKIT_ACTIVATION_KEY=YOUR_ACTIVATION_KEY_GOES_HERE"
$ docker-compose up

Make sure to replace YOUR_ACTIVATION_KEY_GOES_HERE with your PSPDFKit Server activation key. You only have to provide the activation key once, after that the server will remain activated until you reset it.

The example app is now running on http://localhost:3000. You can access PSPDFKit Server's dashboard at http://localhost:5000/dashboard using dashboard // secret.

Login using any user name and upload a PDF, then click on the cover image to see PSPDFKit Web in action.

You can also selectively share PDFs with other users you have created.

Resetting the server

You can reset the server by first tearing down its containers and volumes and then recreating them.

$ docker-compose down --volumes
$ ACTIVATION_KEY=YOUR_ACTIVATION_KEY_GOES_HERE docker-compose up

If you are using Windows make sure to set the environment variables accordingly. For this replace the line starting with PSPDFKIT_ACTIVATION_KEY="... with:

$ SET "PSPDFKIT_ACTIVATION_KEY=YOUR_ACTIVATION_KEY_GOES_HERE"
$ docker-compose up

Running the example locally

You can also run the example app directly on your machine, outside of a Docker container.

Prerequisites

Getting Started

$ git clone https://github.com/PSPDFKit/pspdfkit-server-example-rails.git
$ cd pspdfkit-server-example-rails
$ bundle
$ bin/rails db:migrate
$ bin/rails server

The example app is now running on http://localhost:3000.

Login using any user name and upload a PDF, then click on the cover image to see PSPDFKit Web in action.

You can also selectively share PDFs with other users you have created.

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 the docker-compose.yml and set it to an address that's reachable from your device.

License

This software is licensed under a modified BSD license.

Contributing

Please ensure you signed our CLA so we can accept your contributions.