Linearized PDFs can fail to download - race condition?

WebViewer Version: 8.10.0

Do you have an issue with a specific file(s)?
Linearized PDF files byte range loaded in

Are you using the WebViewer server?

Does the issue only happen on certain browsers?

Is your issue related to a front-end framework?

Please give a brief summary of your issue:
The file fails to ever start downloading. The code is being called and begins to run but it seems like annotationsPromise is never resolving.

Please describe your issue and provide steps to reproduce it:

  1. Programatically or call downloadPdf to download the large pdf in byte range chunks
  2. Try to download the file as soon as PDFtron will let you it’s sorta a race condition so doing it very quickly is the most reliable way to replicate.
  3. In file downloadPdf.js it does call “let annotationsPromise = Promise.resolve()”, and then it hits “annotationsPromise = core.exportAnnotations({ useDisplayAuthor }, documentViewerKey)” but the .then() after it is never being called “annotationsPromise.then(async (xfdfString) => {});” which triggers the file to download.

It can be replicated on the PDFtron demo website if you try it a few times, the download overlay here will just keep looping over and over because I assume the promise never resolves.

Would you be able to share the code to reproduce this issue?

What code would you like me to share? Does PDFtron have a stackblitz template? The steps listed can be done on the PDFtron website to replicate. The code in the screenshot is PDFTron webviewer source code.