applyRedactions API does not return

WebViewer Version:
10.1.0
Do you have an issue with a specific file(s)?
No.
Can you reproduce using one of our samples or online demos?
No.
Are you using the WebViewer server?
No.
Does the issue only happen on certain browsers?
No.
Is your issue related to a front-end framework?
No.
Is your issue related to annotations?
Yes. Redact Annotation.

Please give a brief summary of your issue:
(Think of this as an email subject)
applyRedactions API does not return.

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)

Hello.
I am developing Redact.
Read RedactAnnotation(xfdf) from DB and display it on the screen.
ApplyRedactions immediately after that.
Processing is not returned.

sample code.

protected viewerInstance: WebViewerInstance;

protected Initialize(): void {
  webviewer({fullAPI: true, enableRedaction: true, ...})
    .then((instance: WebViewerInstance) => {
      this.viewerInstance = instance;
      documentViewer.addEventListener('documentLoaded', () => {
        this.onDocumentLoaded();
      });
    }
}

protected onDocumentLoaded(): void {
  const xfdfs = DB.getAnnotationXfdfs();

  await Promise.all(
    xfdfs.map(xfdf ........
      const annot = await this.viewerInstance.Core.annotationManager.importAnnotations(xfdf);
      await this.viewerInstance.Core.annotationManager.redrawAnnotation(annot[0]);
  );

  const redactionList = this.viewerInstance.Core.annotationManager
      .getAnnotationsList()
      .filter(
        (annot) =>
          annot instanceof
          this.viewerInstance.Core.Annotations.RedactionAnnotation
      );
  console.log('redactionList.length = ' + redactionList.length);

    try {
      console.log('11111111111111111');

      const aaa =
        this.viewerInstance.Core.annotationManager.isApplyRedactionEnabled();
      console.log('aaa = ' + aaa);

      const bbb =
        this.viewerInstance.Core.annotationManager.isAnnotationRedactable(
          redactionList[0]
        );
      console.log('bbb = ' + bbb);

      const rtn =
        await this.viewerInstance.Core.annotationManager.applyRedactions();

      console.log('22222222222222222');
      console.log(rtn);
    } catch (error) {
      console.log(error);
    }

}

Console.log
image

(ApplyRedactions() may return very occasionally.)

Am I using applyRedactions() incorrectly?

Best Regards.

Please provide a link to a minimal sample where the issue is reproducible:

1 Like

Hello okabe.yasufumi,

We have a guide available on how to use the applyRedactions API here: Apryse Documentation | Documentation

I haven’t been able to reproduce this issue using our redaction sample here: JS PDF Redaction Demo | Apryse WebViewer

The steps I took to see if the return value was working were:

  1. draw several redactions on the page
  2. enter the following into the browser console in the “webviewer-1” context:
test = await instance.Core.documentViewer.getAnnotationManager().applyRedactions()

  1. get the return value with the correct number of redaction annotations in the console

You mentioned that “ApplyRedactions() may return very occasionally.” Can you explain the steps that you take when you are able to get the return to appear and any differences in when it does not?

Best Regards,

Carlo Mendoza
Web Developer
Apryse

Hello cmendoza,

You mentioned that “ApplyRedactions() may return very occasionally.” Can you explain the steps that you take when you are able to get the return to appear and any differences in when it does not?

About 1 out of 5 times it worked.
There is no difference in the verification procedure.
(I’m using Angular 14.)

I bumped the version from 10.1.0 to 10.2.3.
And I tried 10 times, all successful.

But the changelog doesn’t mention this issue.
Was it fixed by some modification?

Best Regards.

1 Like

Hello okabe.yasufumi,

Looking at our changelog for version 10.2.2, there were several improvements to redaction made. It seems like most were done on the UI side but they could have also resulted in fixes to the issue you were seeing in 10.1.0.

Please let us know if you still find any issues with getting redactions to apply.

Best Regards,

Carlo Mendoza
Web Developer
Apryse

1 Like