pdf view url param

This commit is contained in:
Timur Ercan
2023-01-23 16:32:06 +01:00
parent 5bd6d5a04a
commit 90a18a46b7
2 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import { useState } from "react";
import { Document, Page } from "react-pdf/dist/esm/entry.webpack5";
export default function PDFViewer() {
export default function PDFViewer(props) {
const [file, setFile] = useState("./sample.pdf");
const [numPages, setNumPages] = useState(null);
@ -23,7 +23,7 @@ export default function PDFViewer() {
<>
<div className="">
<Document
file={"/sample.pdf"}
file={props.pdfUrl}
onLoadSuccess={onDocumentLoadSuccess}
options={options}
>

View File

@ -11,7 +11,7 @@ const PDFViewer = dynamic(() => import("../../components/pdf-viewer"), {
const DocumentsDetailPage: NextPageWithLayout = () => {
return (
<div>
<PDFViewer />
<PDFViewer pdfUrl={"http://localhost:3000/api/documents/3"} />
</div>
);
};