This commit is contained in:
Timur Ercan
2023-01-19 20:11:02 +01:00
parent a7830fedb9
commit 598025efaa

View File

@ -13,26 +13,30 @@ export default function PDFViewer() {
setNumPages(nextNumPages); setNumPages(nextNumPages);
} }
const options = {
cMapUrl: "cmaps/",
cMapPacked: true,
standardFontDataUrl: "standard_fonts/",
};
return ( return (
<> <>
<div> <label htmlFor="file">Load from file:</label>{" "}
<div> <input onChange={onFileChange} type="file" />
<label htmlFor="file">Load from file:</label>{" "} <Document
<input onChange={onFileChange} type="file" /> file={"/sample.pdf"}
</div> onLoadSuccess={onDocumentLoadSuccess}
<div> options={options}
<Document file={file} onLoadSuccess={onDocumentLoadSuccess}> >
{Array.from({ length: numPages }, (_, index) => ( {Array.from({ length: numPages }, (_, index) => (
<Page <Page
key={`page_${index + 1}`} key={`page_${index + 1}`}
pageNumber={index + 1} pageNumber={index + 1}
renderAnnotationLayer={false} renderAnnotationLayer={false}
renderTextLayer={false} renderTextLayer={false}
/> />
))} ))}
</Document> </Document>
</div>
</div>
</> </>
); );
} }