PDFTron Web SDK Failed to execute 'readAsArrayBuffer' on 'FileReaderAsync'

Product: PDFTron Web SDK

Product Version: 7.3.0

Please give a brief summary of your issue:
I am trying to linearize a 50+mb file using the code shown below. But it returns the warning shown.
How can I fix this issue?

const linearizePdf = async (fullPath) => {
  return new Promise(async (resolve, reject) => {
    const licenseKey = pdfTronLicenseJs;
    const path = fullPath;
    const extension = 'pdf';

    try {
      let doc = await CoreControls.createDocument(path, { l: licenseKey, extension });

      const options = {
        flags: CoreControls.SaveOptions.LINEARIZED
      };

      let data = await doc.getFileData(options);

      const arr = new Uint8Array(data);
      const blob = new Blob([arr], { type: 'application/pdf' });      
      resolve(blob);
    } catch (err) {
      reject(err);
    }

  });
}

(note: path is a File Object)

Here is a screenshot of the error

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hello there.

Thanks for reaching out.

Instead of trying to debug the code you’ve sent, I’ve checked how to linearized files on PDFTron’s guides and samples and the code below works for me:

Webviewer({
  initialDoc: 'https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf',
  path: '/lib',
  fullAPI: true,
}, document.getElementById('viewer')).then(async (instance) => {
  const { PDFNet } = instance;

  await PDFNet.initialize();

  const doc = await PDFNet.PDFDoc.createFromURL('/envs/7.3/demo-annotated.pdf');

  const docbuf = await doc.saveMemoryBuffer(PDFNet.SDFDoc.SaveOptions.e_linearized);
  const blob = new Blob([docbuf], { type: 'application/pdf' });
});

The path to the file I want to linearized is ‘/envs/7.3/demo-annotated.pdf’, but feel free to use a different path.

Let me know how this works for you and if you have any further questions on this topic.

Best Regards,
Diego Felix
Web Software Developer
PDFTron Systems, Inc.
www.pdftron.com

CONFIDENTIALITY NOTICE: This message (and any attachment to it) is intended only for the use of the individual or entity to which it is addressed in the header, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Any reproduction, distribution, modification or use of the contents of this message (and any attachment to it) by any individual or entity other than the intended recipient is prohibited. If you have received this communication in error, please notify us immediately and delete the original.