Catch warnings and errors outputted by PDFTron web viewer

WebViewer Version: 8.2.0

Do you have an issue with a specific file(s)? N/A
Can you reproduce using one of our samples or online demos? N/A
Are you using the WebViewer server? No
Does the issue only happen on certain browsers? N/A
Is your issue related to a front-end framework? N/A
Is your issue related to annotations? N/A

Please give a brief summary of your issue:
How do I catch and log the warnings and errors that web viewer outputs on the console?

Please describe your issue and provide steps to reproduce it:
I have tried the following adding an event listener to the window object:

window.addEventListener('error', (e) => {

As well as override the console.warn function with my own.

function newWarn() {

console.oldWarn = console.warn;
console.warn = newWarn;

But both do not work. Any guidance is appreciated.

Please provide a link to a minimal sample where the issue is reproducible: N/A

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:


Hi Adrianm
Can I know why you want to catch errors?
Here is a document for the loading error. You can check it out PDFTron.
Let me know if this help you or not


Thanks for this link, I was able to capture errors no problem.
What I would like to ask now is how would l be able to capture warnings like this? Because the one you gave seems to handle errors only.

Hi Adrian
Can I know the reason you want to capture the warning? We currently don’t have any api to capture waring. we have alternative way to disable it. You could check disableLogs in this link PDFTron WebViewer Global. Also maybe you could do this: const oldWarn = instance.UI.iframeWindow.console.warn
Let me if this can help or not