Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot use the same canvas during multiple render() version@2.2.3 #111

Open
jawed7siddiqui opened this issue Jan 8, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@jawed7siddiqui
Copy link

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 21-56-29
Screenshot from 2023-01-08 22-57-24

@jawed7siddiqui jawed7siddiqui added the bug Something isn't working label Jan 8, 2023
@HadesShadows
Copy link

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

@jalombro
Copy link

jalombro commented Feb 8, 2023

Any updates to this? I'm also experiencing the same problem

@XxQuickSilverZz
Copy link

use


{contractPdf && (
            <div className="column has-text-centered" id="base64">
              <PDFViewer
                document={doc}
                scale={1.5}
              />
            </div>
          )}
          

add a condition to avoid re-render

@SubramonianInian
Copy link

The issue can also arise if the strict mode is enabled as the component will render twice.

@vinayak-trivedi
Copy link

vinayak-trivedi commented Dec 21, 2023

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants