Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
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/
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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.