vue-pdf-embed icon indicating copy to clipboard operation
vue-pdf-embed copied to clipboard

Pages stop rendering when switching between pages rapidly.

Open cronco opened this issue 11 months ago • 3 comments

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.

cronco avatar Mar 13 '24 12:03 cronco

Hi @cronco,

Could you provide more details about the environment as well as the version of vue-pdf-embed you are using?

hrynko avatar Mar 13 '24 14:03 hrynko

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.

cronco avatar Mar 13 '24 15:03 cronco

As a workaround to this issue we've used the following tricks:

  • debouncing the page number setter
  • implementing a rendering flag in the parent component that gets set to true when the page is changed and gets set to false in the rendered and renderFailed handlers

cronco avatar Mar 20 '24 12:03 cronco

A fix for this issue has been released in v2.1.0. Thanks for reporting!

hrynko avatar Jul 23 '24 18:07 hrynko