Firefox closeDocument() hanging forever

WebViewer Version:8.12.0

In firefox, after I have loaded a document and then call

await this.instance.Core.documentViewer.closeDocument()

Firefox will be stuck here forever. This works as expected in Chrome. Any thoughts?

according to Apryse Documentation | Documentation i don’t need to close the document but I also can’t open a new one after I opened the first one

Hi Allen,

Thank you for contacting WebViewer Support.
I tried to reproduce the issue but with no success. The following is the code I used:

Webviewer({
  ...
}, document.getElementById('viewer')).then(instance => {
    const { documentViewer, annotationManager } = instance.Core;
    
    document.getElementById('click').addEventListener('click', async () => {
      await documentViewer.closeDocument()
      
      instance.UI.loadDocument(<path-to-file>);
  
      documentViewer.addEventListener('documentLoaded', () => {
        console.log('doc loaded')
      });
    });
  })

Did I understand correctly what you’re trying to do? If the code above is not what you’re trying to achieve, could you please share with us the part of your code related to this issue so we could help you better?

Best,

Dandara Navarro
Web Software Developer
Apryse

The WebViewer is loaded in the background but is never actually visible. We call the below code block to download the pdf with annotations applied and without having to interact with the WebViewer. The works perfectly on Chrome (multiple times), but on Firebox on both Mac and Windows, it hangs where noted the second time it’s called. For example when we download 1 file, then try to download another.

        const { UI, Core } = this.instance
        const { documentViewer, annotationManager } = Core
        await documentViewer.closeDocument() // closeDocument() is where firefox hangs on the second call
        const { app, blob } = await this.downloadFileFromServer(app) // api call
        UI.loadDocument(blob, { filename: `${app.name}.${app.extension}` })
        documentViewer.addEventListener('documentLoaded', async () => {
        // if closeDocument() is removed, the documentLoaded event never fires
          const { data } = await this.getAnnotations(app) // api call
          if (data != null && data.annotations != null) {
            for (const anno of data.annotations) {
              const [annotation] = await annotationManager.importAnnotationCommand(anno)
              if (annotation !== undefined) {
                await annotationManager.redrawAnnotation(annotation)
              }
            }
          }
          await this.instance.downloadPdf({ includeAnnotations: true, flatten: false })
        })

@dnavarro have you had time to consider my reply?

Hi Allen,

My sincere apologies for the delay here. Unfortunately, I’m still not able to reproduce the issue as I cannot have the exactly same code you have. Is there any console error when you run your application on Firefox?
Can you please share with us what you have on the getAnnotations method?
If you have a staging application that we can use to investigate this better it would be great. If you want to share your code privately you can send me through my email: dnavarro@apryse.com.

Best,
Dandara Navarro