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 ( +
+ + {Array.from(new Array(numPages), (el, index) => ( + + ))} + +
+ ); +}; + +export default PDFJsViewer; diff --git a/pages/guidelines.tsx b/pages/guidelines.tsx index c0eeccd..823df6a 100644 --- a/pages/guidelines.tsx +++ b/pages/guidelines.tsx @@ -25,7 +25,7 @@ const PDFViewerPage = () => { }; return ( - +

Напътствия

Важни напътствия за службата

@@ -59,12 +59,23 @@ const PDFViewerPage = () => { ))}
-
{/* Center the PDF with 2rem margin */} - +

+ + Свали Напътствията + +

+ +
+ + {/* +

Your browser does not support PDFs. Please download the PDF to view it: Свали PDF файла.

Вашият браузър не поддържа PDFs файлове. Моля свалете файла за да го разгледате: Свали PDF файла.

-
+
*/}
+ {/* */} + +
);