![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
pdfjs-react-frame
Advanced tools
This is a wrapper for using Mozilla's PDF.js in a React component. https://github.com/mozilla/pdf.js/
This is a wrapper for using Mozilla's PDF.js in a React component. https://github.com/mozilla/pdf.js/
There are a few other examples out there ( this one was particularly useful: https://github.com/seges/react-pdfjs-example )
This builds on those by adding a few abilities:
import PdfJsFrame from 'pdfjs-react-frame';
<PdfJsFrame
style={/* optional style object */}
url={/* URL of a document to fetch - this is required if data is null */}
data={/* A document to display as an arrayBuffer - this is required if URL is null */}
pageNumber={/* The page to scroll to (default: 1) */}
onPageChange={/* optional function to handle page changes, (pageNumber) => { } */}
workerPath=/* optional (default: Mozilla GitHub) path to serve the worker file locally '/pdf.worker.min.js' */
loadingElement={/* optional, e.g. <CircularProgress/> */}
/>
https://developer.mozilla.org/en-US/docs/Web/API/Body/arrayBuffer
This is a bit of a hold-over from the fact that the library isn't really designed for React. I couldn't think of a better way to do this without a fairly big rewrite to PDF.js...
In order to use this, you'll also need to ensure that the file is available and served from your application, e.g. by adding this to your package.json
"postinstall": "echo D|xcopy node_modules\\pdfjs-dist\\build\\pdf.worker.min.js public /sy"
FAQs
This is a wrapper for using Mozilla's PDF.js in a React component. https://github.com/mozilla/pdf.js/
The npm package pdfjs-react-frame receives a total of 6 weekly downloads. As such, pdfjs-react-frame popularity was classified as not popular.
We found that pdfjs-react-frame demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.