https://github.com/shelfio/pspdfkit-ssr
Utilities to work with PSPDFKit's server-side rendering
https://github.com/shelfio/pspdfkit-ssr
nodejs npm-package pdf pspdfkit ssr
Last synced: 7 months ago
JSON representation
Utilities to work with PSPDFKit's server-side rendering
- Host: GitHub
- URL: https://github.com/shelfio/pspdfkit-ssr
- Owner: shelfio
- License: mit
- Created: 2019-06-13T10:13:33.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-02T04:21:44.000Z (over 1 year ago)
- Last Synced: 2025-03-02T05:22:25.770Z (over 1 year ago)
- Topics: nodejs, npm-package, pdf, pspdfkit, ssr
- Language: TypeScript
- Size: 391 KB
- Stars: 2
- Watchers: 22
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# pspdfkit-ssr [](https://circleci.com/gh/shelfio/pspdfkit-ssr/tree/master)  [](https://www.npmjs.com/package/@shelf/pspdfkit-ssr)
## Install
```
$ yarn add @shelf/pspdfkit-ssr
```
## Usage
```js
const {createReadStream} = require('fs');
const {uploadPDF, getJWTForDocumentPreview} = require('@shelf/pspdfkit-ssr');
const documentId = await uploadPDF({
documentId: 'some-custom-document-id',
fileStream: createReadStream('./file.pdf'),
fileSize: 1024,
});
const jwt = getJWTForDocumentPreview(documentId);
```
**Note:** this library relies upon following environment variables:
- `PSPDFKIT_SERVER_URL`
- `PSPDFKIT_SERVER_AUTH_TOKEN`
- `PSPDFKIT_SERVER_JWT_KEY`
- `PSPDFKIT_SERVER_JWT_PASSPHRASE`
**Note:** this library tries to be idempotent.
Unlike PSPDFKit server, it catches errors when document with provided ID was already uploaded.
See [Client Authentication](https://pspdfkit.com/guides/server/current/pspdfkit-server/client-authentication/)
section of PSPDFKit documentation for details.
## Publish
- Run `sudo npx np`, follow interactive UI. Please select appropriate version bump according to [semver](https://semver.org/).
- After redirect to the prepared release of the early published package just press button `Publish release`
## License
MIT © [Shelf](https://shelf.io)