Skip to content

Commit

Permalink
fix(pdf-viewer): the viewer only show 1 page
Browse files Browse the repository at this point in the history
  • Loading branch information
hudy9x committed Mar 27, 2024
1 parent 431003c commit cc0a7c2
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/ui-app/app/_components/PdfViewer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,22 @@ export default function PdfViewer({ src }: { src: string }) {
setLoading(false)
}

const pages = new Array(numPages).fill(1).map((v, i) => i + 1)

return (
<div>
<Loading enabled={loading} title="Parsing..." />
<Document file={src} onLoadSuccess={onDocumentLoadSuccess}>
<Page width={800} pageNumber={pageNumber} />
<Document
file={src}
className="space-y-2"
onLoadSuccess={onDocumentLoadSuccess}>
{pages.map(p => {
return <Page key={p} width={800} pageNumber={p} />
})}
</Document>
<p>
Page {pageNumber} of {numPages}
<p className="text-white">
Total: {numPages} pages
{/* Page {pageNumber} of {numPages} */}
</p>
</div>
)
Expand Down

0 comments on commit cc0a7c2

Please sign in to comment.