if i open pdf files using http/https urls, every time pages are reloading when i scroll them. The previous loaded page is again loading if i come back to same already loaded screen. Same thing happening in bottom thumbnail.
How to maintain it not to load again and again.??
Preamble: you are using view pager loading single page pdfs via http stream, isn't it?
Accessing the file from http stream brings the application to cache only needed datas.
Using that kind of access isn't producing any permanent store on your device.
Loading/unloading file data is due to:
- memory optimization
- maintain the quicker access allowed by the network
Other customers who are adopting single-paged documents preferred to download each page in background with concurrent download threads and open pdf from storage.
In your case, you was saying you've Pdf of 10/12 pages weighted 10Mbs: I can suppose that each page would be less than 1Mb each.
Downloading the first page and showing it just after download will be completed should be a quick operation.
After downloaded the first page, you might start background download for next pages.
No, i'm using single pdf file with multiple pages.
Very first time it is taking time to render, then after swiping between pages is also reloading again and again.
When i dowloaded in local storage then its loading fast. but in my case i have 2 options, online view and offline view. Suppose every day if we download and save in local memory it will be large data after few days. this is not good option for us. User will download on their interest.
http stream, as told, is really like a file system streaming: the tool is maintaining a small cache of needed datas.
The reason is that information and assets in a PDF file might be spread in the file (not contiguous or linear).
For that reason it's not possible to know in advance what the library would need to render a page.
If your files are slow to be rendered first time, it seems aren't optimized for web access: try opening your file in Google Chrome... if optimized you will se pages appearing while download is running, if not optimized you will be able to see the file only when the download is completely done.
If not optimized I suggest you to optimize your files for web.
Even if I've understood your approach, there is now way to give you a simple and running solution:
- http stream are with randomic access, not cached for security and performances reasons.
The access is randomic for 2 reasons: no way to know in advance what the user will like to read, no way to know in advance (from the client) how each page in the PDF file are structured.
- the best and less data consuming way would be to completely download the file on the storage
- otherwise, as done by other customers: split your PDFs in single paged files, download each page one by one and render them in a view pager.
Last approach shall grant your customer to:
- access as quick as possible to each page
- user could interrupt the download process not downloading completely the magazine
- you will lose thumbnails as are rendered on the actual PDF and, from page to page in the view pager the "actual PDF file" will contain only a single page... so thumbnail will be with the same single page.
After your requests about view pager, during last few days, we did some work on it and found an issue in view pager code which is bringing to a memory leak and consequent crash.
Dev team released an internal version two days ago and, after some more tests we will release it today.
It seems you've not yet defined the better way to design your UI and UX.
To avoid you wasting more time I suggest you to open a ticket (on the trouble ticket platform) and address it to sales / pre-sales requests: normally we don't offer such a kind of support but after an internal discussion we agreed to better listening to you.