Intercept/Overwrite Download Function in WebViewer

WebViewer Version: 8.10.0

We have the use case in which the pdftron WebViewer is running in a embedded Chromium instance (CEF) .
In this case, the build in download functionality failed (not implemented). But we have the possibility, to handle a download which a custom API.

Is it possible to intercept/overwrite the download/extract functionality?

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.