Open jawed7siddiqui opened 1 year ago
I am facing the same issue for the example URL. Even the local pdf is giving the error. It renders for a millisecond and the the error pops up
Any updates to this? I'm also experiencing the same problem
use
{contractPdf && (
<div className="column has-text-centered" id="base64">
<PDFViewer
document={doc}
scale={1.5}
/>
</div>
)}
add a condition to avoid re-render
The issue can also arise if the strict mode is enabled as the component will render twice.
@jawed7siddiqui @jalombro @nikhilnaik5, not sure if you have figured a solution for this, but for me adding key solves the issue, adding example code as well here
<PDFViewer
key={pdfFile}
document={{
url: pdfFile,
}}
/>
Notes: this issue will still be there in dev mode because it renders twice
pdf-viewer-reactjs.js:192 Error occured while rendering ! version@2.2.3 Error: Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed. at InternalRenderTask.initializeGraphics (pdf.js:3480:1)
![Screenshot from 2023-01-08 22-57-24](https://user-images.githubusercontent.com/97095625/211210181-746fcfd4-4669-494f-84a9-9faf43de2487.png)