Requirements
The React, PDF.js, bundler and browser versions React PDF Viewer is tested with.
Only versions covered by the project’s automated tests are listed here. Other versions may work but are not verified.
Prerequisites
| Dependency | Supported | Tested in CI |
|---|---|---|
react, react-dom | peer >=18.0.0 | 18.3 and 19.3 |
pdfjs-dist | peer ^6.0.0 | 6.3 |
| TypeScript (optional) | declarations target modern TypeScript | 6.0 |
| Node.js (for building your app) | >=20 | 22 |
The package is ESM-only and has no runtime dependencies besides its peers.
Bundlers and frameworks
Each of these is exercised by a consumer smoke test that installs the packed package into a fresh app and builds it for production:
| Target | Tested version | Guide |
|---|---|---|
| Vite | 8.3 | Vite |
| Next.js (App Router, server rendering) | 16.3 | Next.js |
| webpack | 5.111 | webpack |
Browsers
Browser tests run in the current versions of Chromium, Firefox and WebKit (Playwright engines). PDF.js 6 relies on recent browser APIs, so use current browsers, or the legacy PDF.js build for older ones; see PDF.js configuration. Microsoft Edge (Chromium) and Safari (WebKit) share those engines but are not tested separately.
Installation
See Installation.
Minimal example
import { PdfViewer } from '@kingtech/react-pdf-viewer';
import '@kingtech/react-pdf-viewer/styles.css';
export const Viewer = () => <PdfViewer source="/files/report.pdf" />;
Verify
Your install matches the supported versions when npm ls react pdfjs-dist (or the pnpm/yarn equivalent) lists versions inside the ranges above and the minimal example renders the first page.
Next steps
- Installation
- Versions for the support policy
- Security for the PDF.js version constraints