Intercept/Overwrite Download Function in WebViewer

Hello,

Thank you for contacting WebViewer support.

There is an API called updateElement that you can use to override the onClick function of the download button.

You can call:

instance.UI.updateElement('downloadButton', {
    onClick: () => console.log('download button clicked'),
});

If you try the code above, you’ll notice that when you click on the download button, instead of making the download, it will just log a message. So, instead of the console.log, you’ll add your logic.

Best,

Dandara Navarro
Web Software Developer
PDFTron Systems, Inc.