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

View File

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