react-fast-pdf is a performant React component library engineered for efficient viewing and previewing of PDF documents within web applications. It is currently at stable version 1.0.33 and maintains an active, continuous release cadence, with new versions automatically published to npm upon merging pull requests to the main branch. Key differentiators for this library include its highly optimized rendering engine, allowing it to handle PDF files of virtually any size with robust performance, and its design for easy customization to integrate seamlessly into various application designs. Developed and supported by Expensify, it aims to consolidate the best features found in other PDF viewing solutions into a single, streamlined, and user-friendly tool for React developers.
npm install react-fast-pdfVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to embed and render a PDF document using the `PdfViewer` component, including basic state management for the PDF URL and event handling for load success or error. It provides a full, runnable React component.
Ensure `package.json` is reverted to `"react-fast-pdf": "^1.*"` or the appropriate published version before committing or deploying. Always run `npm install` after changing this dependency path.
Ensure your project's `react` and `react-dom` versions are `18.x` or compatible. Upgrade your React dependencies if necessary using `npm install react@^18 react-dom@^18`.
Verify that `lodash@4.x` is installed in your project's dependencies: `npm install lodash@^4`. If you have a different major version, consider if your project can upgrade to `4.x` or if a separate `lodash@4.x` installation is needed.
Check your `package.json` for conflicting React versions. Ensure `react` and `react-dom` are both `^18.0.0`. Run `npm dedupe` or `yarn why react` to identify and resolve duplicate React installations.
Verify the PDF `url` prop is correct and publicly accessible. Check browser console for network errors (e.g., 404, CORS blocking). Ensure the hosted file is indeed a valid PDF.
Ensure `lodash@^4` is correctly installed as a direct or transitive dependency in your project. Run `npm install lodash@^4` if it's missing or check `npm ls lodash` to confirm the installed version.