A React component to wrap PDF.js
React-pdf-js is a component that utilizes PDF.js to render PDF documents in a React application. It provides functionalities for loading and displaying PDF files with various customization options.
To install react-pdf-js, use either yarn or npm:
yarn add @mikecousins/react-pdf pdfjs-dist
or
npm install @mikecousins/react-pdf pdfjs-dist
Then, utilize the usePdf hook in your application. Remember to pass in necessary props like canvasRef
, file
, and page
.
React-pdf-js is a useful component for integrating PDF rendering capabilities into a React application. With features like the usePdf hook, customization options, error handling, and configuration settings for cmaps and workers, developers can efficiently work with PDF files while building React applications.