🌐
npm
npmjs.com › package › react-pdf
react-pdf - npm
February 25, 2026 - Display PDFs in your React app as easily as if they were images.. Latest version: 10.4.1, last published: 2 months ago. Start using react-pdf in your project by running `npm i react-pdf`. There are 1051 other projects in the npm registry using ...
      » npm install react-pdf
    
Published   Feb 25, 2026
Version   10.4.1
🌐
React-pdf
react-pdf.org
React-pdf
React renderer for creating PDF files on the browser and server
Discussions

reactjs - How to use PDF.JS with React? - Stack Overflow
I would like to parse a pdf file in a React app. The pdf will be provided through a html input. I used pdf-parse - a wrapper around pdf.js in node - without any problem. But when it comes to React, I More on stackoverflow.com
🌐 stackoverflow.com
A deep dive into PDF.js layers and how to render truly interactive PDFs in React.
Looks like a great learning resource when I start on the next project I want to do. Bookmarking for later. More on reddit.com
🌐 r/reactjs
20
86
July 9, 2025
How to Use Mozilla PDF.js with React.js for Client-Side Rendering & Basic Tools?
Alternative: use an iframe inside your reactjs project, call pdfjs viewer and customise this page to your needs More on reddit.com
🌐 r/react
4
5
July 27, 2023
Best library for showing a pdf in react
If you don't need direct control over the PDF in any way, then just use an IFrame. It'll make the browser use their default viewer, which is generally a pretty decent one. There's also one made by Mozilla ( PDF.js ), but any PDF viewer is going to be pretty heavy in terms of code size. More on reddit.com
🌐 r/reactjs
26
34
December 2, 2022
🌐
GitHub
github.com › wojtekmaj › react-pdf
GitHub - wojtekmaj/react-pdf: Display PDFs in your React app as easily as if they were images. · GitHub
Add React-PDF to your project by executing npm install react-pdf or yarn add react-pdf. If you use Next.js prior to v15 (v15.0.0-canary.53, specifically), you may need to add the following to your next.config.js:
Starred by 11K users
Forked by 1K users
Languages   TypeScript 94.5% | CSS 5.4% | HTML 0.1%
🌐
npm
npmjs.com › package › react-pdf-js
react-pdf-js - npm
June 19, 2019 - Simple React component to wrap up PDF.js. The easiest way to render PDFs in your React app.. Latest version: 5.1.0, last published: 7 years ago. Start using react-pdf-js in your project by running `npm i react-pdf-js`. There are 32 other projects in the npm registry using react-pdf-js.
      » npm install react-pdf-js
    
Published   Jun 19, 2019
Version   5.1.0
Author   mikecousins
🌐
GitHub
github.com › mikecousins › react-pdf-js
GitHub - mikecousins/react-pdf-js: A React component to wrap PDF.js
react-pdf-js provides a component for rendering PDF documents using PDF.js.
Starred by 803 users
Forked by 151 users
Languages   TypeScript 90.7% | JavaScript 6.9% | CSS 2.0% | HTML 0.4% | TypeScript 90.7% | JavaScript 6.9% | CSS 2.0% | HTML 0.4%
🌐
PDF.js Express
pdfjs.express › documentation › get-started › react
Integrate React & JavaScript PDF Viewer | PDF.js Express SDK
const MyComponent = () => { const viewer = useRef(null); return ( <div className="MyComponent"> <div className="header">React sample</div> <div className="webviewer" ref={viewer}></div> </div> ); }; Inside of useEffect hook or componentDidMount lifecycle method initialize WebViewer. Ensure that the path property in the constructor points to where you copied static assets node_modules/@pdftron/pdfjs-express/public in React public folder.
🌐
Nutrient
nutrient.io › blog › sdk › how to build a reactjs viewer with pdfjs
Build a React PDF viewer with pdfjs-dist and Next.js: Step-by-step tutorial
February 20, 2026 - In this tutorial, you’ll learn how to create a React PDF viewer using pdfjs-dist(opens in a new tab), the official npm distribution of PDF.js(opens in a new tab) — Mozilla’s open source JavaScript library for rendering PDF documents.
🌐
Nutrient
nutrient.io › blog › sdk › how to build a reactjs pdf viewer with react pdf
How to build a React PDF viewer with react-pdf (2026)
January 28, 2026 - Install react-pdf (npm install react-pdf), import the Document and Page components, configure the PDF.js worker in the same file, and build your own navigation controls.
Find elsewhere
🌐
Stack Overflow
stackoverflow.com › questions › 73919619 › how-to-use-pdf-js-with-react
reactjs - How to use PDF.JS with React? - Stack Overflow
export default function Home() { const [data, setData] = useState(); const handleFile = (e) => { const file = e.target.files[0]; const fileReader = new FileReader(); fileReader.onload = (d) => { setData(new Uint32Array(d.target.result)); }; }; return ( <> <h1>hello!</h1> <input type="file" accept="application/pdf" placeholder="insert PDF here" onChange={(e) => handleFile(e)} /> <PDFViewer pdfFile={data} /> </> ); }
🌐
Apryse
apryse.com › blog › building-react-pdf-viewer-with-pdfjs
How to Build a React PDF Viewer with PDF.js
October 17, 2018 - In this tutorial, we show you how to create a React PDF viewer using PDF.js that you can use in your projects to open a PDF file and display its pages.
🌐
CodeSandbox
codesandbox.io › examples › package › react-pdf-js
react-pdf-js examples - CodeSandbox
Use this online react-pdf-js playground to view and fork react-pdf-js example apps and templates on CodeSandbox.
🌐
Medium
medium.com › @hesseclaus › using-pdfjs-with-react-app-rewired-f1f3a2527c45
Using PDFjs with react-app-rewired | by Claus Hesse | Medium
December 22, 2023 - First of all make sure that the version of pdfjs-dist that you are using is compatible with your node version. In my case “pdfjs-dist”: “2.7.570” is working ok on node 14. Then, since we are using react-app-rewired, we can override webpack configs by creating a config-overrides.js in our ...
🌐
PDF.js Express
pdfjs.express › documentation › get-started-viewer › react
Integrate React & JavaScript PDF Viewer | PDF.js Express Viewer SDK
This guide will help you integrate PDF.js Express Viewer into a React application on the browser.
🌐
Reddit
reddit.com › r/reactjs › a deep dive into pdf.js layers and how to render truly interactive pdfs in react.
r/reactjs on Reddit: A deep dive into PDF.js layers and how to render truly interactive PDFs in React.
July 9, 2025 -

Hey r/reactjs,

I wanted to share an article I just wrote about a topic that can be surprisingly tricky: rendering PDFs in React.

It's easy enough to get a static image of a PDF page onto a <canvas>, but if you've ever tried to make the text selectable or have links that actually work, you know the real challenge begins there.

I ran into this and did a deep dive into how PDF.js actually works. It turns out the magic is in its layer system. My article breaks down the three key layers:

  • The Canvas Layer: The base visual representation of the PDF.

  • The Text Layer: A transparent layer of HTML elements positioned perfectly over the canvas, making the text selectable and searchable.

  • The Annotation Layer: Another transparent layer that handles things like clickable links within the PDF.

The post walks through what each layer does and then provides a step-by-step guide on how to build a React component that stacks these layers correctly to create a fully interactive and accessible PDF viewer.

Hope this is useful for anyone who's had to wrestle with PDFs in their projects! I'll be hanging around in the comments to answer any questions.

Article Link: Understanding PDF.js Layers and How to Use Them in ReactJS

🌐
React PDF Viewer
react-pdf-viewer.dev › docs › basic-usage
Basic usage - React PDF Viewer
at Worker.MessageHandler._onComObjOnMessage (pdf.js:6846) However, if you use the Webpack bundler, setting the same version for both worker and the `pdfjs-dist` package can be automated. There are two ways to archive that: Compile and set the worker source with Webpack · Keep the worker version in sync with pdfjs-dist version · If you use the viewer component in different pages, it's recommended to place the `Worker` at the layout level. For example, in a typical React application, we often render the `App` component at a `root` element as following: render(<App />, document.getElementById('root')); In this case, we should use the Worker component inside the `App` component: const App = () => { return <Worker workerUrl="https://unpkg.com/pdfjs-dist@3.4.120/build/pdf.worker.min.js">...</Worker>; }; When the worker is ready, it's time to use the viewer component.
🌐
React PDF Viewer
react-pdf-viewer.dev › docs › getting-started
Getting started - React PDF Viewer
React PDF Viewer uses the APIs provided by the popular pdfjs library. Execute the following command from the root folder to install pdfjs: npm install pdfjs-dist@3.4.120 · The `pdfjs-dist` will be added to the `dependencies` section in ...
🌐
Reddit
reddit.com › r/react › how to use mozilla pdf.js with react.js for client-side rendering & basic tools?
r/react on Reddit: How to Use Mozilla PDF.js with React.js for Client-Side Rendering & Basic Tools?
July 27, 2023 -

Hey everyone,

I hope you're all doing well! 🖐️

I'm currently working on a React.js project that involves rendering PDFs on the client side, and I stumbled upon Mozilla's PDF.js library. While it seems promising, I'm facing some challenges when it comes to integrating it into my project and adding some basic tools like annotations and highlighting.However, I've been struggling to find comprehensive documentation on how to integrate PDF.js with React.js effectively.

Has anyone here successfully used PDF.js with React.js before? I'd really appreciate some guidance on the best practices for integration and any tips or resources to add basic tools for annotations and highlighting.

Feel free to share your experiences, code snippets, or any helpful tutorials that you've come across. Your insights will be of great help to a fellow developer.

Thank you all in advance! 😊🙏

🌐
npm
npmjs.com › package › @pdf-viewer › react
pdf-viewer/react
February 16, 2026 - A react-pdf-viewer component for React and Next.js. Suitable for react-pdf document.. Latest version: 1.19.0, last published: 2 months ago. Start using @pdf-viewer/react in your project by running `npm i @pdf-viewer/react`. There are no other projects in the npm registry using @pdf-viewer/react.
      » npm install @pdf-viewer/react
    
Published   Feb 16, 2026
Version   1.19.0
🌐
npm
npmjs.com › package › @react-pdf › renderer
react-pdf/renderer
4 days ago - import React from 'react'; import ReactPDF from '@react-pdf/renderer'; ReactPDF.render(<MyDocument />, `${__dirname}/example.pdf`);
      » npm install @react-pdf/renderer
    
Published   Apr 10, 2026
Version   4.4.1