How to recover from a download failed scenario?

Product: PDFTron Webviewer (Web SDK)

Product Version: 7.3.0

I am experiencing “Download failed” warnings in pdftron and I don’t know how I can re initialize the download process. To describe the what is happening:

  1. I feed a 300mb file into the viewer via URL.
  2. I look into dev tools network tab and see the viewer requesting chunks of the file (my back end supports byte ranges).
  3. In the middle of downloading the file, the pdf viewer stops and outputs a warning that says “Download failed”.

I am seeing pdftron viewer do more download requests after the prompt of “Download failed”, but after successfully requesting these chunks, the viewer still doesn’t display anything and is stuck to what was displayed before the warning prompt.

Here is a snippet of code where the system attempts to view the pdf, as you can see, I simply pass a url to the loadDocument function.


    WebViewer({ 
      ...
      fullAPI: true
    }, this.viewerElement).then(async (instance) => {

        file_upload.addEventListener('change', async () => {

        if (file_upload.value)
          this.attachmentId = file_upload.value;
               
        this.url = '';

        if (!this.attachmentId)
          return;

          this.url = projectionPage.urlFor(`Download/AttachmentPartial/${this.attachmentId}?verbose=false`);
        }

          instance.loadDocument(this.url, { filename: this.filename });        

      });

    });

  }

I would appreciate If anyone can point me into the right direction.

Is this “Download failed” warning happens on all the files?
If you access the file from a browser window: Download/AttachmentPartial/${this.attachmentId}?verbose=false , can you view that file?

I tried to run your code with some files loaded from my localhost and I didn’t see any errors/warnings

If you can provide me with the file you are using, I’d like to give it a try.

Oscar

It happens on all files yes, but only intermittently. I have 2MB, 5MB 20MB, and 300MB files as my test cases.

Yes I can access the content of the URL indicated with no issue:

I’ll get back to you getting a copy of the file I am using.