diff --git a/components/pdfViewer.jsx b/components/pdfViewer.jsx new file mode 100644 index 0000000..8d2fcf2 --- /dev/null +++ b/components/pdfViewer.jsx @@ -0,0 +1,30 @@ +import React, { useState, useEffect } from 'react'; +import { pdfjs, Document, Page } from 'react-pdf'; + +// Set workerSrc to load PDF.js worker (important for performance) +//pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`; + +const PDFJsViewer = ({ fileUrl }) => { + const [numPages, setNumPages] = useState(null); + + function onDocumentLoadSuccess({ numPages }) { + setNumPages(numPages); + console.log("PDF pages: " + numPages); + } + + return ( +