How to cancel page rendering

Which product are you using?
PDF.js Express Plus

PDF.js Express Version

Detailed description of issue
When I open huge document then I waiting for rendering. Before document is full rendered I close (hide) viewer and them it’s look like pages are still rendered in background - my site and browser are slowdown (till I reload page).

I hide viewer according to best practices
and on hide viewer I also try to relase resources


How can I cancel rendering and release resources properly?

Expected behaviour
Rendering is cancelled, all resources are released properly and no operation is performed in the background.

Does your issue happen with every document, or just one?
Large documents

Hello user45,

Can you provide a sample project to reproduce this issue?

Best regards,
Tyler Gordon

I loaded document with


and after some time close them and try to release resources as I already mentioned.
How exactly I should close, stopping background operations and release resources properly of viewer?

Hello user45,

Please ensure any references to the viewer have been cleared or any properties being saved, this can keep a reference to the instance stored in memory.

If you are still downloading the document from the server or fetching data, you’ll need to cancel that as well.

Best regards,

Thank you, I’m ensured of that.
Could you explain me, which exactly functions I should call when I close (hide) webviewer (to achive stop rendering and release resources)?

Hello user45,

I would first dispose the DocumentViewer using (be sure to dereference any refs to documentviewer:

let docViewer = instance.Core.documentViewer.
docViewer = null;

And then do the same for the UI (same with the derefrencing):


Best regards,