Problem with CustomApplyRedactionsHandler

Hi !
I want to have some custom logic when clicking on the ‘Redact All’ button. I tried to use CustomApplyRedactionsHandler . But I get this error:

Uncaught (in promise) TypeError: instance.UI.setCustomApplyRedactionsHandler is not a function

Documentation:

WebViewer(...)
  .then(function(instance) {
    instance.UI.setCustomApplyRedactionsHandler((annotationsToRedact, originalApplyRedactionsFunction) => {
      // custom code
      ...
      originalApplyRedactionsFunction();
    })
  });

My code:

window.webviewerFunctions = {
    initWebViewer: function () {
        const viewerElement = document.getElementById('viewer');
        WebViewer({
            path: 'lib',
            initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf', // replace with your own PDF file
            fullAPI: true,
            enableRedaction: true
        }, viewerElement).then((instance) => {

            instance.UI.setCustomApplyRedactionsHandler((annotationsToRedact, originalApplyRedactionsFunction) => {

                console.log("My logic comes here!");

                originalApplyRedactionsFunction();
            });
        })
    }
};

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:

Guides:APIs:Forums:

Hello @traderaboy

I’ve tried to reproduce the issue on WebViewer 8.5 (The version that introduced the API), but I could not. What’s the WebViewer version you are using?

Hello @dfelix
We used WebViewer version 8.4.1. But we upgraded to WebViewer 8.5 and it works now.
Thank you.