-
Notifications
You must be signed in to change notification settings - Fork 189
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
rangeChunkSize Doesnt Work With Version 12.1.2 #2566
Comments
Good question... but I'm pretty sure these two settings are bad for you: pdfDefaultOptions.disableAutoFetch=true;
pdfDefaultOptions.disableStream =true; Just stick to the defaults. I also suspect your |
I assume the second code snippet is C# code? |
Yes it's c# |
The reponse header is more important than the request. The first response should look like this: I've described the details here: https://pdfviewer.net/extended-pdf-viewer/range-requests |
Ah, we're getting closer. To be honest, this is a part of the viewer I haven't fully understood. If my research is correct, the first request is a traditional request without range requests. You know, in the beginning, the PDF viewer doesn't know whether the server supports range requests or not. When the PDF viewer detects that the server is able to process range requests, it cancels the first request and starts sending range requests. It's the server's responsibility to stop sending data when the client has canceled the request. I don't know how you've implemented your server. I suspect you must care about canceling the request explicitly. |
@timvandermeij I know my idea doesn't make much sense for the Firefox PDF viewer - but still, I wonder if I should add a mode that starts requesting range requests immediately. Maybe I'm wrong, but to me, the current approach of fetching the entire file and canceling the request doesn't feel efficient. What's your opinion? And is there a documentation explaining how pdf.js implements streaming and range requests? |
I tried to cancel request and try to send StatusCode CancelRequest Or even tried to created empty bytes with same length but i gives me 500 I have others Question if u dont mind
|
Documentation, and my knowledge, about this is a bit sparse unfortunately, but I think mozilla/pdf.js#11669 (comment) explains the situation well and should still be correct. There is also d0297cfb97c14385/src/display/api.js#L197-L206, mozilla/pdf.js#8768 and mozilla/pdf.js#6126 that might help. If you would like to know more, you can also ask in the PDF.js Matrix room; please see https://github.com/mozilla/pdf.js?tab=readme-ov-file#questions. |
Ah Thanks, I also can't find plenty and suitable resources. But I will continue digging in this. |
@NourKhashan You can debug what's going on in the client side. Just set the attribute |
Oh, and I'm 99% sure the issue is on the server side. On the client side, range requests work out-of-the-box if the server supports them. Whether tweaking the size of the chunks is a good idea or not probably depends on the size of the PDF pages. For most documents, 64K is a good choice. |
In Server Side I do as documentation and in documentation in Get Request it return whole File if Range Request Is Null, Range is send as null from Client Side and this is point and it take alot of time. |
I'm closing this ticket now because I think I've told you everything I know about the topic and because I don't support old version of ngx-extended-pdf-viewer. I'd like to support old versions, but it's simply not possible because I don't have enough time to spare, so I reluctantly focus on the current version. |
I need your help!
I have Large File (1 GB), So I dont want to download whole file as I take alot of time to display fist page.
So I want to use rangeChunkSize to get 1 MB Bytes of file and when scrolling I want to get next 1 MB but it doesnt work the range header doesnt send, therefore whole file download.
Check this first
this is my Setting
In Get Method In API I Set Response Header
Describe the bug
But in Request the range header doesnt sent with URL, and I use .net Core it support Range Header.
Do I need in backend to add another api with specific header before get request or what missconfigure that i do.
Version info
ngx-extended-pdf-viewe : 12.1.2
Angular CLI: 12.1.1
Node: 14.15.0
Thanks In Advance
The text was updated successfully, but these errors were encountered: