Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF Data Range not working correctly #46

Open
joepio opened this issue Jun 26, 2019 · 2 comments
Open

PDF Data Range not working correctly #46

joepio opened this issue Jun 26, 2019 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@joepio
Copy link
Member

joepio commented Jun 26, 2019

Ideally, only the currently selected page of a PDF is downloaded. This makes initial rendering faster, since only the first page has to be fetched.

PDF.js (the underlying library) does support this.

I think the problem is present in one of these requirements:

  • The server has to accept range requests in HTTP header.
  • The PDF has to be web-optimized.
  • React-PDF should include these headers in its requests.

Let's take this pdf for example. It is optimized for web view (checked in Adobe Reader => file => properties). Google Cloud storage seems to support Range headers.

Maybe the problem has something to do with the redirect, since the first URL is redirected to https://storage.googleapis.com/ori-static/api.notubiz.nl/document/6131301. In the response header, accept-ranges: bytes is present. In the request, I can't see a range header.

This seems to work:

GET https://storage.googleapis.com/ori-static/api.notubiz.nl/document/6131301 HTTP/1.1
Range: bytes=0-1999

So... The problem is probably with react-pdf.

react-pdf does support a PDFDataRangeTransport object as a prop for file, but I'm not quite sure on how to use this prop (docs).

@joepio
Copy link
Member Author

joepio commented Jul 31, 2019

Posted the issue to pdf.js

@joepio joepio added this to the v1.1 milestone Aug 9, 2019
@joepio
Copy link
Member Author

joepio commented Aug 13, 2019

There might be an issue with our Google Storage as well. Posted an issue on their tracker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant