{"repo":"mikecousins/react-pdf-js","free":true,"listed":false,"github":"https://github.com/mikecousins/react-pdf-js","clone":"git clone https://github.com/mikecousins/react-pdf-js.git","description":"A React component to wrap PDF.js","language":"TypeScript","stars":807,"topics":["react","pdf","pdf-viewer","es6","es6-javascript","reactjs","tsup","typescript","vite"],"license":"MIT","category":"media-processing","readme_excerpt":"react-pdf-js react-pdf-js provides a component for rendering PDF documents using PDF.js. --- Demo https://react-pdf.cousins.ai Usage Install with yarn add @mikecousins/react-pdf pdfjs-dist or npm install @mikecousins/react-pdf pdfjs-dist usePdf hook Use the hook in your app (showing some basic pagination as well): Props When you call usePdf you'll want to pass in a subset of these props, like this: const { pdfDocument, pdfPage } = usePdf({ canvasRef, file: 'https://example.com/test.pdf', page }); canvasRef A reference to the canvas element. Create with: const canvasRef = useRef(null); and then render it like: and then pass it into usePdf. file URL of the PDF file. onDocumentLoadSuccess Allows you to specify a callback that is called when the PDF document data will be fully loaded. Callback is called with PDFDocumentProxy as an only argument. onDocumentLoadFail Allows you to specify a callback that is called after an error occurred during PDF document data loading. onPageLoadSuccess Allows you to specify a callback that is called when the PDF page data will be fully loaded. Callback is called with PDFPageProxy as an only argument. onPageLoadFail Allows you to specify a callback that is called after an error occurred during PDF page data loading. onPageRenderSuccess Allows you to specify a callback that is called when the PDF page will be fully rendered into the DOM. Callback is called with PDFPageProxy as an only argument. onPageRenderFail Allows you to specify a callback that","default_branch":null,"files":null,"tree":[],"storefront":"/r/mikecousins","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/mikecousins/react-pdf-js/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}