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

Add "silent" option to suppress console messages

Open christopherwk210 opened this issue 5 months ago • 1 comments

There are a lot of console.log's in this project, and it would be nice if there was a way to toggle their usage to keep the console clean.

In addition, when started to load a PDF and then destroying the component (by navigating away with vue-router while auto-destroy is set to true, for instance) then there are many uncaught exceptions in the console:

TypeError: Cannot read properties of null (reading 'ensureDoc')

My guess is that something is happening in the worker after the component has already been lost. It would be nice if these exceptions were caught to prevent console flooding as well.

Thank you for your consideration, happy to help in any way I can.

christopherwk210 avatar Jul 07 '25 13:07 christopherwk210

Much of those console.log's are printed by pdf.js directly, this library does not include any log but errors.

In addition, when started to load a PDF and then destroying the component (by navigating away with vue-router while auto-destroy is set to true, for instance) then there are many uncaught exceptions in the console:

TypeError: Cannot read properties of null (reading 'ensureDoc')

My guess is that something is happening in the worker after the component has already been lost. It would be nice if these exceptions were caught to prevent console flooding as well.

Yup, this error is thrown when there is some pending promises and the worker was destroyed before those promises resolve, I am not sure if it is possible to include something like "silent" option... could you share some reproducible sample of this case?

TaTo30 avatar Jul 13 '25 05:07 TaTo30