# @shelf/pspdfkit-ssr

> Utilities to work with PSPDFKit's server-side rendering

Latest version **4.0.1** (published 2023-11-13) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @shelf/pspdfkit-ssr
pnpm add @shelf/pspdfkit-ssr
yarn add @shelf/pspdfkit-ssr
bun add @shelf/pspdfkit-ssr
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 4.0.1 |
| Published | 2023-11-13 |
| First published | 2019-06-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=16 |
| Dependencies | 4 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Vlad Holubiev |
| Maintainers | kateryna-kochina, maksym.tarnavskyi, andrii-nastenko, d-mii-, mykhailo.yatsko, ahavrysh, nikita_shelf, maciej.orlowski, monopotan, andrew214, bogdan.kolesnyk, andrii.batutin, kamilmaczugashlef, kristina.zhak, anton-russo, mmazurowski, toms-shelf, mateuszgajdashelf, kchlon, dmytro.harazdovskiy, duch0416, i5adovyi, olesiamuller, mykola.khytra, yuliiakovalchuk, el_scrambone, bodyaflesh, slavammellnikov, andriisermiahin, mpushkin, batovpavlo, domovoj, vozemer, oleksii.dymnich, dima-bond, maksym.hayovets, oles.zadorozhnyy, ss1l, gemshelf, hartzler, vladgolubev, marianna-milovanova, hmelenok, knupman, maaraanas, terret, chapelskyi.slavik, pihorb, irynah, diana.kryskuv, andy.raven, rafler, sskalp88, demiansua, yuriil, ktv18, drews_abuse, rostyslav-horytskyi, whodeen |
| Keywords | pspdfkit, ssr |

## Links

- npm: https://www.npmjs.com/package/@shelf/pspdfkit-ssr
- Repository: https://github.com/shelfio/pspdfkit-ssr
- npm.io page: https://npm.io/package/@shelf/pspdfkit-ssr

## Dependencies (4)

- [ms](https://npm.io/package/ms.md) 3.0.0-canary.1
- [form-data](https://npm.io/package/form-data.md) 4.0.0
- [node-fetch](https://npm.io/package/node-fetch.md) 2.6.12
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) 9.0.0

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 4.0.1 (latest) — 2023-11-13
- 3.2.0 — 2023-09-15
- 3.1.4 — 2023-09-06
- 3.1.3 — 2023-09-06
- 3.0.0 — 2022-07-15
- 2.1.5 — 2021-12-15
- 2.1.4 — 2021-12-14
- 2.1.3 — 2021-10-25
- 2.1.2 — 2021-10-25
- 2.1.1 — 2021-10-25
- 2.0.1 — 2019-10-09
- 2.0.0 — 2019-07-22
- 1.0.1 — 2019-07-19
- 1.0.0 — 2019-07-19
- 0.1.1 — 2019-06-13
- … 1 more at https://npm.io/package/@shelf/pspdfkit-ssr/versions

## README

# pspdfkit-ssr [![CircleCI](https://circleci.com/gh/shelfio/pspdfkit-ssr/tree/master.svg?style=svg)](https://circleci.com/gh/shelfio/pspdfkit-ssr/tree/master) ![](https://img.shields.io/badge/code_style-prettier-ff69b4.svg) [![npm (scoped)](https://img.shields.io/npm/v/@shelf/pspdfkit-ssr.svg)](https://www.npmjs.com/package/@shelf/pspdfkit-ssr)

## Install

```
$ npm install @shelf/pspdfkit-ssr
```

## Usage

```js
import {createReadStream} from 'fs';
import {uploadPDF, getJWTForDocumentPreview} from '@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)

---
_Source: https://npm.io/package/@shelf/pspdfkit-ssr · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
