This example shows how to integrate PSPDFKit for Web into a React app.
- Node.js (with npm or Yarn)
- A PSPDFKit for Web license. If you don't already have one you can request a free trial here.
Clone the repo.
git clone https://github.com/PSPDFKit/pspdfkit-web-example-react.git
cd pspdfkit-web-example-react
Install the pspdfkit
npm package.
npm install --save https://customers.pspdfkit.com/npm/YOUR_NPM_KEY_GOES_HERE/latest.tar.gz
Bootstrap the project by installing all the other dependencies. In this example we use Create React App.
npm install
Now that everything is installed we need to configure the app to use our PSPDFKit for Web license key.
Open up the package.json
file from this repo, find and replace all the occurrences of YOUR_LICENSE_KEY_GOES_HERE
with the license key that you received via e-mail.
We are ready to launch the app! ๐
To run the app in development mode:
npm run start
To create a production build of the app and serve it:
npm run build
serve -s build
Enjoy ๐
The React component which implements the PSPDFKit for Web integration can be found at src/components/pspdfkit/index.js
.
To run this example via Create React App we also had to configure the baseUrl
that PSPDFKit for Web uses to load its artifacts and base css. Please take a look at src/App.js
.
In order to make the files above available we had to copy them from the node_modules/pspdfkit/dist
folder using a script which you can find at scripts/copy-pspdfkit-files
.
This software is licensed under a modified BSD license.
Please ensure you have signed our CLA so that we can accept your contributions.