Linearized pdf doesnt load over presigned s3 url

PDF.js Express Viewer

8.7.5

PDF is not loading as linearized. I download the 2gb-sample-file from pdfjs.express website and uploaded to my s3 bucket. I am using pre signed URL from s3 to load into viewer. But it downloads the complete file. Initially I was linearizing the files and testing it but when it didn’t work, then I downloaded the sample file from pdf express website. All the other functionalities work excellent but our files are in higher Mbs and sometime in Gbs.

Since the file is linearized, I expect it to show initial pages faster.

It happens with all documents.

//pdf link is resigned url
  ngOnChanges() {
    if(this.pdfLink!=undefined && this.webViewerInstance!=undefined) {
        this.wvInstance.UI.loadDocument("this.pdfLink", { filename: this.fileName });
        this.wvInstance.UI.setFitMode(this.wvInstance.UI.FitMode.FitWidth);
    }
  }
  
  ngAfterViewInit(): void {
    this.createWebViewerInstance();
  }

  createWebViewerInstance() {
    this.webViewerInstance = WebViewer({
      licenseKey: 'xxxxxxxxxxxxxx',
      path: '../../assets/lib',
      initialDoc: this.pdfLink
      }, this.viewer.nativeElement).then(instance => {
        this.wvInstance = instance;
        this.docViewer = instance.Core.documentViewer;       
      });
  }

Hi there,

If you look at the network panel, are you getting 206 request for your linearized file?

Are you able to reproduce on the demo? PDF.js Viewer Demo | PDF.js Express

Best regards,
Kevin Kim

Yes I am able to reproduce the issue on demo site as well.

Can you share the s3 url to reproduce?
Do you see the 206 requests?

Best regards,
Kevin Kim

There are no 206s. Only 1 200 response that downloads the file

That means the server hosting the file has not set up the range requests, you can read more about it here:

See this forum post for more details:

Best regards,
Kevin Kim

Hi, i met the same issue when loading an Linearized pdf file but got 200 status from the server, Iam using UI.loaddocument(“url”), is there anyway to sent request with headers using UI.loaddocument?

Thanks for info. We have had missing configuration in our s3. We are seeing multiple 206s after adding those config but even then the pdf is not loading partially. It waits for all the 206s to complete before rendering pdf.
Any thoughts ?

Hi there,

This is expected behaviour, please see this forum post for more details:

Best regards,
Kevin Kim