vue-pdf-embed
vue-pdf-embed copied to clipboard
Pages stop rendering when switching between pages rapidly.
When switching pages rapidly, the canvas sometimes stops showing and we get the following error in the rendering-failed event listener:
Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.
The stack trace traces it to initializeGraphics in pdf.js.
Hi @cronco,
Could you provide more details about the environment as well as the version of vue-pdf-embed you are using?
Tested on Mac Sonoma on latest Chrome (122.0.6261.112 (Official Build) (arm64)), but have got reports of users on Chrome on Windows seeing the same issue.
The production app is on vue-pdf-embed 1.2.1, but I am testing 2.0.2 and I am getting similar results.
As a workaround to this issue we've used the following tricks:
- debouncing the page number setter
- implementing a
renderingflag in the parent component that gets set totruewhen the page is changed and gets set tofalsein therenderedandrenderFailedhandlers
A fix for this issue has been released in v2.1.0. Thanks for reporting!