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

disableAutoFetch=true not working with big pdf #3811

Closed
geiregjo opened this issue Oct 16, 2013 · 9 comments · Fixed by #3848
Closed

disableAutoFetch=true not working with big pdf #3811

geiregjo opened this issue Oct 16, 2013 · 9 comments · Fixed by #3848
Labels

Comments

@geiregjo
Copy link

I'm having issues with the disableAutoFetch param. It works with the example pdf but not with a big pdf file. Note that I'm retrieving the pdf file in chunks, that part is working beautifully. But it seems to download the complete file ignoring the disableAutoFetch param. I've been investigating this issue for a few hours now but couldn't find much. I'll continue my effort but I'm hoping on some input of you guys!

The pdf file that I used to test:
http://www.nbb.be/DOC/BA/PDF7MB/2010/201011400154_2.pdf

I found out that the viewer first caches a few pages and that this is normal behaviour. But after caching those few pages it downloads all the others. It's like some other component is invoking this. Its the same as when you open the example pdf and then do a text search. That action triggers the viewer to download the pdf completely.

@brendandahl
Copy link
Contributor

There's something strange going on with that pdf. It doesn't seem to be doing range requests. Also, when I use our browser to explore the object structure and expand the contents of one page it gives me the stream with the entire pdf in it.

@brendandahl
Copy link
Contributor

Disregard the comment about the browser. It was a bug I introduced in the browser.

@geiregjo
Copy link
Author

So you are able to reproduce the problem? I do have the same issue with other files. I'll try again with a very big text only pdf file and see what happens.

@geiregjo
Copy link
Author

I just tested some different pdfs. I created a docx source with google docs and generated 3 pdf's from it.

  • Libre Office (880.0 kb)
  • Google Docs (599.5 kb)
  • Microsoft Office (28.1 MB)

Disabling the autofetch doesn't work with the Libre Office file. It does work with the other ones. Note that the one generated by Microsoft Office get's almost completely loaded. Is this because the very small file size? The one generated by Google Docs is loaded in nice chunks.

@brendandahl
Copy link
Contributor

The problem is we traverse the whole page tree which causes the majority of the chunks of the PDF to be fetched. I have a patch to fix this, but it requires redoing some other pieces as well.

@iFadey
Copy link

iFadey commented Jan 14, 2015

@brendandahl
I tried disabling auto fetch in pdf.js build "1.0.1065".
It works fine in latest Chrome, Opera, and IE11 but the weird part is that it's not working in latest Firefox and not even in Firefox Developer Edition.
In Firefox it keeps loading until complete PDF is loaded

@Snuffleupagus
Copy link
Collaborator

@iFadey You also need to disable streaming, which was added in PR #5263, for this to work; see https://github.com/mozilla/pdf.js/blob/master/src/display/api.js#L90-L96.

@iFadey
Copy link

iFadey commented Jan 14, 2015

@Snuffleupagus I see. Let me try it. Thanks!

@iFadey
Copy link

iFadey commented Jan 14, 2015

Yes it's working now with stream disabled.
Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants