Closed scry-UrjitDesai closed 1 month ago
Good question. It works on my showcase. I suspect sometimes the streaming API interferes with the range requests. The idea of streaming is that the viewer displays pages while loading. That's even better than using range requests. However, I don't know why it refuses to work on some machines. My showcase is a simple Apache httpd server. The configuration activates range requests. I've described it here: https://pdfviewer.net/extended-pdf-viewer/range-requests
If range requests work, it should look like so:
In your installation, the chunks should be 64 KB. The showcase configures 128 KB for demonstration purposes.
Did my hint help you? If so, please tell me, so I know I can safely close the ticket.
Yes, thank you. I have managed to get the range request working on my server. However, I have a use case where in lets assume that i have a list of page numbers. When the user clicks on a page number, I want to load that specific page first and then continue to fetch all the pages using the range-request.
That's pretty much the default behavior of the viewer. Unfortunately, when I implemented the early versions of the viewer, I wasn't able to set the target page number before loading the file. So I've implemented a workaround: the initial page number is 1, and a short time later, [pageNumber]
sets the target page number. However, that's after loading the first page.
After loading the document, the viewer works exactly the way you need: it doesn't load unused pages, and loads them only when the user clicks the page. At least, that's how I remember it. If it doesn't work this way, please tell me. Sorry for delegating work to you: I can't check it right now myself because I'm busy at the moment.
Description I want to display a large pdf (>700 pages). I am trying to use range-request for the same. On the showcase, it says that range-request should enabled by default and if my server has range-requests enabled then it should work correctly. The issue I am facing is that even though in my networks tab I can see multiple calls being made to my server and my server returning the appropriate response, the entire pdf is loaded at once only when all the network calls are completed.
To further debug the issue, I tried to set [src] to a path on my local system. Even then, the entire pdf is being loaded all at once only after all the network calls are completed.
Am I missing something? Do you have a working example or some documentation to how I can implement this ?
Here is my angular snippet-
HTML
TS
Version info