[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multi image PDF continuous mode

From: Juri Linkov
Subject: Re: Multi image PDF continuous mode
Date: Sat, 08 Jan 2022 20:17:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

> I would like to share my perspective on this, but before I do that,
> let me first ask you if you have any idea about why pdf-tools is not part of
> Emacs. It is a very high quality package, that already lazily loads the 
> images,
> and provides many sophisticated features.

It would be nice to include pdf-tools in Emacs, but I don't know
if the new maintainer has an intention to submit it for inclusion.

> You might already be familiar with my 2-buffer continuous scroll hack for it
> (which can be easily ported to doc-view mode, but 'developing' a 'real'
> continuous scroll mode solution makes much more sense

I agree, a real continuous scroll mode would be more preferable.

> - I have created a, very rude but already nicely working, 'real' continuous
>   scroll proof of concept, for which, if you are interested, you can find the
>   code in this commit. It currently uses a trick where it only uses two images
>   at the time

While two-images approach could provide better optimization for memory,
it has severe limitations, e.g. the vertical scroll bar can't be used
to scroll all images at once.

>   but as I will describe now, I think it will be better to create a
>   'bookroll' package for it.

This is a promising direction.

> I think the bookroll should not be so difficult to implement (I first started 
> to
> think about a general 'image-roll', but I think continuous scrolling is
> generally not what you want for viewing/scrolling images

Why not?  'image-roll' could be useful for the image gallery packages
like image-dired.el and thumbs.el.

> So my current idea for how to implement it, is by
> immediately creating overlays for all pages in a single buffer and fill them
> with 'empty' svg-images of the correct size (after testing this with a 
> thousand
> 'placeholders', it seems that the 'empty' images use almost no memory).

Good news, so loading a 1000-page document won't take much memory.
Only scrolling will load real images.  Maybe then after a real image
will be scrolled out of view, it could be replaced with a placeholder again
to free memory.

> Then, the scrolling can be implemented, by changing the display properties 
> (from empty
> svg to real image, and back) and jumping to the correct positions using
> `set-window-vscroll`. I have started on writing bookroll.el, of course your
> joined efforts or feedback would be very much appreciated. Otherwise, this 
> short
> message serves just to inform you about these activities.

Thanks, feel free to post updates about your progress
or when stuck on some problems.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]