Hi Lucas,
Sorry for the inconvenience. We suspect that there is miscommunication happened when initially we tried to understand your requirement. Initially we suspect that you were reported memory issue with PDF Viewer. Now we could see that your requirement is to load whole document to memory or load more pages to avoid blank display of pages in between the control when on fast scrolling. Please find the details below.
Virtualization: We do load the whole document into the memory and parse the basic information such as page count, dimensions etc..., to specify the control height and updating the toolbar values. But only the page parsing process from the PDF document is done in on-demand basis. Currently we parse and keep only few pages in live based on the current scrolled location and the View Port size in a virtualized way.
Page parsing process: The pages parsing process involves creating a bitmap image of the page from PDFium along with extracting and storing the information present in the pages such as text, images, annotations, calculating the bounds of the text for select and search etc..., So, parsing and keeping all the bitmap images and resource collection will be both time and memory consuming.
Magnification: Also, in every zoom change, we generate new image with respect to the current magnification to maintain the content quality. In those cases, we may need to keep images with different magnifications in live. It will be even more in the case of documents with more pages or documents with heavy content pages.
Resource sharing and scroll performance: For some of the resource sharing across many pages, we need to handle in the UI thread, instead of background thread as it might result in dead lock. So, when parsing more pages, this might result in affecting the smooth scrolling performance when increasing the buffer pages. So, we wait until the scroll is stopped, and parse the pages to generate the images. So that the blank pages are seen in between when on fast scrolling. The reason for parse and keep only the few pages in live is not only for keeping the memory under limit, but also for maintaining the smooth scrolling experience.
For the above-mentioned reasons, currently we do not have plans to parse and keep all the pages in memory. Please let us know if you have any concerns or if our observation is different to your requirement.
Regards,
Divya D