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