🌐
npm
npmjs.com › package › react-pdf
react-pdf - npm
October 9, 2025 - Display PDFs in your React app as easily as if they were images.. Latest version: 10.2.0, last published: 2 months ago. Start using react-pdf in your project by running `npm i react-pdf`. There are 985 other projects in the npm registry using ...
      » npm install react-pdf
    
Published   Oct 09, 2025
Version   10.2.0
Author   Wojciech Maj
🌐
GitHub
github.com › wojtekmaj › react-pdf
GitHub - wojtekmaj/react-pdf: Display PDFs in your React app as easily as if they were images.
Display PDFs in your React app as easily as if they were images. - wojtekmaj/react-pdf
Starred by 10.7K users
Forked by 981 users
Languages   TypeScript 94.3% | CSS 5.6% | HTML 0.1%
Discussions

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
85
July 9, 2025
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
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
Help with PDF.js performance
Here is a simple example for pdfjs+react at https://github.com/yurydelendik/pdfjs-react . Looks like the react "pros" are not trying to be involved in pdfjs (judging by e.g. https://github.com/erikras/react-pdfjs/issues/1 responses), so it will be hard to find any ready-to-use react components on the market. P.S. see also https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#allthepages More on reddit.com
🌐 r/reactjs
1
3
June 20, 2017
🌐
GitHub
github.com › mikecousins › react-pdf-js
GitHub - mikecousins/react-pdf-js: A React component to wrap PDF.js
A React component to wrap PDF.js. Contribute to mikecousins/react-pdf-js development by creating an account on GitHub.
Starred by 799 users
Forked by 151 users
Languages   TypeScript 90.7% | JavaScript 6.9% | CSS 2.0% | HTML 0.4%
🌐
Nutrient
nutrient.io › blog › sdk › how to build a reactjs viewer with pdfjs
Build a React PDF viewer with PDF.js and Next.js: Step-by-step tutorial
July 16, 2025 - To get started with rendering PDFs using PDF.js in a React application, you first need to set up our development environment. You’ll use Next.js, a popular React framework, to create the project structure. Run the following command to scaffold a new Next.js project inside a folder named pdfjs-d...
🌐
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

🌐
Stack Overflow
stackoverflow.com › questions › 73919619 › how-to-use-pdf-js-with-react
reactjs - How to use PDF.JS with React? - Stack Overflow
import * as PDFJS from "pdfjs-dist/build/pdf"; import * as pdfjsWorker from "pdfjs-dist/build/pdf.worker.entry"; window.PDFJS = PDFJS; export default function PDFViewer({ pdfFile }) { PDFJS.GlobalWorkerOptions.workerSrc = pdfjsWorker; const getPDFDoc = useCallback(async () => { const doc = await PDFJS.getDocument(pdfFile); doc.promise.then( (loadedPdf) => { setPdfRef(loadedPdf); }, function (reason) { console.error(reason); } ); }, []); useEffect(() => { getPDFDoc(); }, [getPDFDoc]); I doesn't seem to work at all. I have a custom config with webpack, typescript and SWC-loader. I have read all the related stackoverflow threads. How to properly parse a PDF with PDF.js in React?
🌐
Mozilla
mozilla.github.io › pdf.js
PDF.js - Home
A general-purpose, web standards-based platform for parsing and rendering PDFs.
Find elsewhere
🌐
React PDF Viewer
react-pdf-viewer.dev › docs › basic-usage
Basic usage - React PDF Viewer
pdfjs uses a web worker to process the most tasks which take time such as parsing and rendering a PDF document.
🌐
PDF.js Express
pdfjs.express › documentation › get-started › react
Integrate React & JavaScript PDF Viewer | PDF.js Express SDK
This guide will help you integrate a free trial of PDF.js Express into a React application on the browser.
🌐
React-pdf
react-pdf.org
React-pdf
React renderer for creating PDF files on the browser and server
🌐
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 › 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: 6 years ago. Start using react-pdf-js in your project by running `npm i react-pdf-js`. There are 31 other projects ...
      » npm install react-pdf-js
    
Published   Jun 19, 2019
Version   5.1.0
Author   mikecousins
🌐
React PDF
blog.react-pdf.dev › understanding-pdfjs-layers-and-how-to-use-them-in-reactjs
Using PDF.js Layers in React.js Effortlessly
July 17, 2025 - Use PDF.js layers in React.js for improved PDF viewing with text selection, annotations, and structure capabilities
🌐
CodeSandbox
codesandbox.io › examples › package › pdfjs-dist
pdfjs-dist examples - CodeSandbox
react-pdf-viewer-vite · pdfjs-dist-vue · react-doc-viewerDocument viewer for react. Renders online/local documents. @react-pdf-viewer/examples · flexcomAplicacion para la comunicacion interna. pdf-viewer (forked) lex961Find more examples or templates · AboutGeneric build of Mozilla's PDF.js library.6,183,977Weekly Downloads ·
🌐
DhiWise
dhiwise.com › post › ultimate-guide-to-using-pdfjs-react-in-your-react-application
Steps To Seamlessly Integrate Pdfjs-react Into Your React App
July 31, 2024 - This provides a solid foundation to start working with PDFs in your React app. To begin, you'll need to install the pdfjs-react library.
🌐
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.
🌐
npm
npmjs.com › package › pdfjs-dist
pdfjs-dist - npm
2 weeks ago - Generic build of Mozilla's PDF.js library.. Latest version: 5.4.449, last published: 12 days ago. Start using pdfjs-dist in your project by running `npm i pdfjs-dist`. There are 2279 other projects in the npm registry using pdfjs-dist.
      » npm install pdfjs-dist
    
Published   Nov 29, 2025
Version   5.4.449
🌐
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.
🌐
jsDelivr
jsdelivr.com › package › npm › react-pdf-with-legacy-pdfjs
react-pdf-with-legacy-pdfjs CDN by jsDelivr - A CDN for npm and GitHub
January 15, 2023 - A free, fast, and reliable CDN for react-pdf-with-legacy-pdfjs. [![npm](https://img.shields.io/npm/v/react-pdf.svg)](https://www.npmjs.com/package/react-pdf) ![downloads](https://img.shields.io/npm/dt/react-pdf.svg) [![CI](https://github.com/wojtekmaj/react-pdf/workflows/CI/badge.svg)](htt...
Published   Jan 15, 2023