Hacker News new | ask | show | jobs
by pbhjpbhj 4072 days ago
This seems like the way to do it. You basically have the browser load in pages of content, keep x pages above the viewport, y pages below ready to scroll on to, then you're holding x+y pages. You remove pages when scrolled far enough past and add pages to keep y-1 pages in hand. The problem then is that a user might scroll through a lot of content and then choose to scroll back - eg if they're sampling for quality first and then selecting on a subsequent pass.

How do pdf viewers handle this wrt memory conservation. If you have a 1000 page pdf, scroll through a couple of hundred pages (using a infinite scroll type view), what does the viewer do with viewed content, it has to cache it somehow, right?

Maybe the infinite scroll needs to be more accomodated by the browsers rather than just not used. I know in certain circumstances (image search, reddit on mobile) that I find it useful.

1 comments

I think PDF viewers cache a low(er) resolution rasterized version of pages. And are simply much faster, because - as far as I know - PDF has rather precise position and dimension data already included, so there are no need for further passes (no reflows).