Add "addEventListener" to Redaction Panel

Hi !
I want to add “addEventListener” to Redaction Panel. It should be called when Redaction panel is opening or closing.

Hello traderaboy,

One way that you can add an event listener to see if the Redaction Panel is opening or closing would be to attach an event listener to the UI itself that checks for visibilityChanged on the Redaction Panel.

For example:

  instance.UI.addEventListener('visibilityChanged', e => {
    const { element, isVisible } = e.detail;
    if (element === 'redactionPanel') {
      console.log('Redaction Panel is open? ' + isVisible);
    }
  });

More information on visibilityChanged can be found here: PDFTron WebViewer Namespace: UI
and information on adding event listeners to the UI can be found here: PDFTron WebViewer Namespace: UI

Best Regards,
Carlo Mendoza
Software Developer
PDFTron Systems, Inc.
www.pdftron.com

1 Like