react-pdf icon indicating copy to clipboard operation
react-pdf copied to clipboard

Fetched (external) PDF is not loading only on iOS mobile device (Cordova)

Open alek9a1 opened this issue 1 year ago • 0 comments

Before you start - checklist

  • [X] I followed instructions in documentation written for my React-PDF version
  • [X] I have checked if this bug is not already reported
  • [X] I have checked if an issue is not listed in Known issues
  • [X] If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

import { pdfjs , Document, Page } from 'react-pdf/dist/esm/entry.webpack'; // it already has pdf worker

<Document 
      file={url}  
          onLoadSuccess={onDocumentLoadSuccess}
          onSourceError={error => onDocumentSourceError(error)}
          onLoadError={error => onDocumentLoadError(error)}>
       <Page onLoadError={error => onPageLoadError(error)}
       pageNumber={pageNumber} />
</Document>

It works on Chrome, Safari desktop. It works on Android Device (Cordova).

It is not working on iOS device (Cordova).

The error I got onDocumentLoadError: undefined is not an object (evaluating 'e.body.getReader').

Test it with different PDF's, local one are fine and open correctly, but external not. There is no CORS errors showed.

Steps to reproduce

The error I got onDocumentLoadError: undefined is not an object (evaluating 'e.body.getReader') only on iOS devices (simulators and phisycal devices)

Expected behavior

Working on iOS devices

Actual behavior

Not working on iOS devices

Additional information

No response

Environment

  • Browser (if applicable):
  • React-PDF version:
  • React version:
  • Webpack version (if applicable):

alek9a1 avatar Aug 05 '22 09:08 alek9a1