Skip to content
This repository has been archived by the owner on Aug 7, 2022. It is now read-only.

Feature request: continuous view #27

Closed
oscarfv opened this issue Jan 13, 2015 · 40 comments
Closed

Feature request: continuous view #27

oscarfv opened this issue Jan 13, 2015 · 40 comments

Comments

@oscarfv
Copy link

oscarfv commented Jan 13, 2015

Is it feasible to implement viewing the top of the next page when you reach the end of the current page? While reading e-books and scrolling down with Space as you advance it is unpleasant that when the bottom of the page is reached the line that was previously at the bottom of the screen now it can be located anywhere depending on the zoom level etc. Other pdf viewers solve this by showing the top of the next page below the current one and thus always advancing the same amount of space on each scroll operation.

Ditto for scrolling up.

@politza
Copy link
Owner

politza commented Jan 13, 2015

We could have a fixed-scroll-mode.

Displaying more than one page/image per window is not going to happen
anytime soon.

@oscarfv
Copy link
Author

oscarfv commented Jan 13, 2015

How would work that fixed-scroll-mode?

If Emacs could do the same amount of scrolling every time Space is hitted, it would be good enough for now. Maybe adding empty lines after the image?

@politza
Copy link
Owner

politza commented Jan 13, 2015

How would work that fixed-scroll-mode?

Like you described.

@titaniumbones
Copy link
Contributor

Right now the lack of a continuous mode is the only thing that I miss from other viewers. From what you say, this is unlikely to work -- I guess because the buffer is only capable of displaying one image at a time? And is that a fundamental constraint?

In any case I find the jump fro mthe bottom of one page to the top of the next hard to follow. It's too bad because otherwise pdf-tools is already way better than any other viewer!

@politza
Copy link
Owner

politza commented Nov 18, 2015

Matt Price notifications@github.com writes:

[...] the buffer is only capable of displaying one image at a time?
And is that a fundamental constraint? [...]

No, but there are some difficulties to overcome. I already have an idea
how, but haven't found the energy to go ahead. I could elaborate, If
you care.

@thisirs
Copy link

thisirs commented Nov 26, 2015

I'd love the see this feature implemented... This is actually the only thing that keeps me from switching to pdf-tools (which is great btw ;))

@antoine-levitt
Copy link

+1 on the comments, this package is great and I'd love to switch to it, but the lack of continuous scrolling is what's keeping me back.

@clubfed
Copy link

clubfed commented Feb 4, 2017

+1

@Compro-Prasad
Copy link

Compro-Prasad commented Jul 19, 2017

I think that it would be better if you could elaborate so that someone could get how to solve this problem and submit a merge request.

@guilhermemtr
Copy link

I also feel that it would be a great new feature to pdf-tools (I actually subscribed to this issue waiting for updates on this feature).

This is what I think is meant by the feature request (illustrated with images, using evince):
Image 1:
screenshot from 2017-07-21 16-54-05

Image 2:
screenshot from 2017-07-21 16-53-48

Basically, it would be great to be able to scroll the whole document (instead of only having the page by page display), and have the pages appearing as if they were only one very long page (but keeping the delimiters, as in the images).

@politza
Copy link
Owner

politza commented Jul 21, 2017

Generally speaking, there are two issues:

  1. Large parts of the software (including image-mode) assume a one-to-one correspondence between a displayed page and its window.
  2. Emacs is not easily convinced to scroll an image, such that its display starts in the middle of it, in case would completely fits into the window.

@Compro-Prasad
Copy link

Can't we display a limited number of images vertically(max 4 pages) in the same buffer and scroll it normally. When we hit the next page or the next next page we can remove images above and add new ones below. I mean it may be something like (save-excursion (redisplay-images)) .

@Compro-Prasad
Copy link

Spacemacs accomplishes a scrolling behaviour by remapping the keys but with no continuous effect.

@guilhermemtr
Copy link

If I programmed in el I would do the request, but I don't.
Maybe, here is a way to do it:

Use 5 images [0,1,2,3,4].
When the user scrolls out of image[2], start loading image[0] or [4] (depending if it's a scroll up or down).
When the user is reaching the bottom half of [3] (or top-half of [1]): shift the image array down (or up)*, load the new image in [4] (or [0]) and make the pdf shift the view to make a smoother transition (and hopefully seemless)

*e.g. [img1,img2,img3,img4,img5] -> [img2,img3,img4,img5,img??]
Is this doable?
I'm not aware of the implementation details so it might be completely out.

@hisnawi
Copy link

hisnawi commented Sep 15, 2017

Any updates on this?

@pprw
Copy link

pprw commented Oct 19, 2017

+1 on this feature request. I personally want also to see double page mode on pdf-tools (see #303).

@Compro-Prasad
Copy link

I think we should have a feature request in Emacs for an infinite background scroll mode. Which would help in solving this issue.

@narendraj9
Copy link

narendraj9 commented Dec 12, 2017

@politza How about merging images of two pages together into a single image with the line break in between? I mean taking what is on the screen and merging it with the next page's image such that it feels like we scrolled just a bit even though we actually replaced the whole image.

@nerrons
Copy link

nerrons commented Apr 24, 2018

+1 for this feature.

@bricewge
Copy link

bricewge commented Jun 25, 2018

With the release of emacs 26.1 there is a new mode called pixel-scroll-mode that could help us having continus view in pdf-tools; I didn't yet tried it though.

@Compro-Prasad
Copy link

pixel-scroll-mode isn't production ready yet. It lags seriously on my machine. I am running Arch Linux.

@francesco-cadei
Copy link

+1 with this feature i could free myself from any other pdf-viewer.

@Emrys-Merlin
Copy link

+1 from me, too :-)

@vonpupp
Copy link

vonpupp commented Dec 22, 2018

+1, I am evaluating switching to pdf-tools. So far, I find it awesome and it is highly likely for me to switch, even without this feature. It would be awesome to have it, it would help to keep the immediate context of the reading in one screen.

@braham-snyder
Copy link

Though I too would love to see this feature, "+1"-style posts send every subscriber a notification -- I (and I suspect many other subscribers) would greatly appreciate it if everyone instead gave the OP a thumbs up (by clicking the smiley face in its top right corner).

(For those who haven't ran into it: GitHub's issue tracker can sort issues by the numbers of reactions they've each garnered -- ideally, IMO, we'd have explicit issue voting with votes displayed next to the number of comments as in isaacs/github#9, but unfortunately that didn't look like it was going to happen last I checked.)

@shader
Copy link

shader commented Mar 20, 2019

Would it be reasonable to use convert -append (or whatever the library equivalent is) to vertically attach the images from several pages together? Then we could put 2-3 pages into one PNG, and it wouldn't matter whether or not emacs natively supported displaying multiple images. I know that emacs already uses image-magick in other places. I don't know how much that would mess up the interactive parts of pdf-tools though.

@politza
Copy link
Owner

politza commented Mar 20, 2019 via email

@oscarfv
Copy link
Author

oscarfv commented Jul 9, 2019

One of the main conveniences of continuous scroll mode is to visually keep track of the point you are looking at when the image scrolls up/down. My recent experience with ebook readers is that an animated scroll helps a lot on this regard. The animation needs to be "smooth" and "progressive" so that the eyes effortlessly keep track of the point of interest.

About a year or two ago I looked at pixel-scroll-mode and found it inadequate, if not utterly broken, for scrolling images. Maybe now things are better. Also, recent Emacs development introduced improvements on image handling (rotation and zooming, mostly, but it would be interesting to inquire if the improvements can be extended to pixel-based positioning and glitch-free fast repainting).

@politza
Copy link
Owner

politza commented Jul 26, 2019

At least scrolling the window such that an image is only partially displayed if it could be completely displayed otherwise seems to be possible with recent Emacs versions.

@forgetmenotz
Copy link

forgetmenotz commented Mar 17, 2020

Just wondering if there is any possibility of ever seeing this introduced or if its abandoned at the moment? One page at a time is too clunky.

I compiled Koreader for arch recently which allows continuous scrolling, and with some hacks, maybe half page scrolling, key based search and highlighting. The reason being, I get visual defects in Zathura. But of course the power of Emacs is still missing. And zoom is not working for me either in pdf-tools.

@ThibautVerron
Copy link

Off the top of my head, you could also try the pdf viewer in the emacs application framework.

@ThibautVerron
Copy link

In my opinion, there is no good way to support multiple images per window without rewriting large parts of this package.  I've started something like this, though I currently don't have much time to spend on it. And yes, what you're proposing  would mess up almost everything. Also, it's not Emacs that is the problem, but the assumptions made by this package.

Is it really "large parts of the package", or just essentially most of pdf-util.el? Or is it like a large part of the code makes assumptions beyond the output of the tools defined in pdf-util and those would need to be found/examined one by one?

@dalanicolai
Copy link

dalanicolai commented Sep 21, 2020

EDIT:

  • I HAVE EXTENDED THE FILE HERE A LITTLE AND REWRITTEN IT TO A MINOR MODE, CHECK OUT THE NEXT COMMENT

  • I noticed that this hack requires Emacs 27 (although it is probably quite straightforward to adapt the code to Emacs 26 by replacing the display-buffer-in-direction functions with its Emacs 26 equivalents)

EDIT END

I have created a dirty hack in this file.
It implements continuous scroll by creating a second buffer when needed and then resizes it while scrolling.
It might be useful for people who "desperately" ;) require continuous scrolling behavior.
It looks arguably better when you remove the mode-line (which can be achieved by uncommenting the hook at the beginning of the file).
Also it contains a function, pdf-view-toggle-continuous, to toggle between the normal continuous view behavior and the hacked behavior.
continuous-scroll-demo
You can use it by downloading the file and add something similar to

  (setq pdf-view-continuous 'hack)
  (eval-after-load "pdf-view"
    '(load "~/git/dala-emacs-lisp/pdf-continuous-scroll.el"))

in your user-config.

Generally the selected buffer is the upper buffer. Although the hack might get extended to support control from both the lower and the upper buffer (in some "dual-buffer-mode", so that it could jump back to single buffer mode when needed, e.g. when searching or visiting some entry from the pdf-annot-list).

@dalanicolai
Copy link

dalanicolai commented Sep 26, 2020

So here is a little enhanced version of the file in the previous comment. Probably this minor-mode will get updated a few times over the next days, so keep your eyes on it. This mode works only from Emacs 27 (see previous commment). It includes keybindings to just work also on Spacemacs.

https://github.com/dalanicolai/pdf-continuous-scroll-mode.el

Just load the file and pdf-tools will start up in continuous scroll mode. You can then just toggle the mode on and of using M-x pdf-continuous-scroll-mode. If you don't want to start pdf-tools with the minor mode activated then comment out the hook at the start of pdf-continuous-scroll-mode.el.

Of course any feedback is welcome (possibly by opening an issue in the repo).

@dalanicolai
Copy link

dalanicolai commented Aug 1, 2021

For the ones still interested... I have just created a (not very, but still) simple sketch to obtain "real" continuous scrolling (i.e. in a single buffer). You can check it out here. It would be great if others would also like to hack on it. With pdf-tools, and docview as an example, together with the very simple to use python-epc and the amazing pymupdf documentation, a lot should be possible. On the other hand, I understand that, like for myself, this will not have priority. But it could be fun and educational. I started this for fun and to show a proof of concept.

@dalanicolai
Copy link

Another project would be to replace epdfinfo with the pymupdf plus python-epc solution in pdf-tools. It would provide possibilities to add more styles of annotations like in pymupdf-mode and support for editing forms.

@oscarfv
Copy link
Author

oscarfv commented Aug 1, 2021

Another project would be to replace epdfinfo with the pymupdf plus python-epc solution in pdf-tools. It would provide possibilities to add more styles of annotations like in pymupdf-mode and support for editing forms.

For some people adding Python as a dependency is not trivial.

@emacsomancer
Copy link

@dalan

For the ones still interested... I have just created a (not very, but still) simple sketch to obtain "real" continuous scrolling (i.e. in a single buffer). You can check it out here. It would be great if others would also like to hack on it. With pdf-tools, and docview as an example, together with the very simple to use python-epc and the amazing pymupdf documentation, a lot should be possible. On the other hand, I understand that, like for myself, this will not have priority. But it could be fun and educational. I started this for fun and to show a proof of concept.

(missing link: https://github.com/dalanicolai/pdf-continuous-scroll-mode.el ? )

@dalanicolai
Copy link

@emacsomancer Thanks for pointing that out, I have added the link to https://github.com/dalanicolai/vimura-epc now

@bob333
Copy link

bob333 commented Sep 25, 2021

Thanks for this package. The following code will help to install this package since its not available in melpa, It does by first installing quelpa and then using it to install this package.

(use-package quelpa
  :ensure t)

(use-package pdf-tools
  :ensure t
  :after (quelpa)
  :config
  (pdf-tools-install t)
  (quelpa '(pdf-continuous-scroll-mode
          :fetcher github
          :repo "dalanicolai/pdf-continuous-scroll-mode.el"))

  (add-hook 'pdf-view-mode-hook 'pdf-continuous-scroll-mode))

@politza politza closed this as completed Aug 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests