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();
});
})
}
};