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

Double pages layout #303

Closed
pprw opened this issue Aug 25, 2017 · 5 comments
Closed

Double pages layout #303

pprw opened this issue Aug 25, 2017 · 5 comments

Comments

@pprw
Copy link

pprw commented Aug 25, 2017

Is it possible to display two pages in a row (double page layout in evince is an example)?

If no, I propose it as a feature request.

@politza
Copy link
Owner

politza commented Aug 25, 2017

See #27. The same applies to a 2-column view or any other variant that wants to display more than one page per window.

@pprw
Copy link
Author

pprw commented Oct 19, 2017

Another way to implement double page layout could be to have one page per buffer but with synchronized buffers (when I move forward on buffer 1 to see page 33, buiffer 2 moves also and display page 34).

Double page mode is very useful when reading book in fullscreen mode. With the 16/9 ratio and the big screen of today, you have to display two page if you want to fill the space in fullscreen.

@pprw
Copy link
Author

pprw commented Jan 15, 2018

Any news? Is it something you consider implementing in short or long term?

@ghost
Copy link

ghost commented Jun 15, 2018

Opening two windows to the same buffer seems to make this possible. Below is a function that scrolls both windows and jumps both to two pages ahead upon reaching the end when pdf-view-continuous is set.

(defun my-pdf-view-double-scroll-up-or-next-page (&optional arg)
  "Scroll page up ARG lines if possible, else go to the next page.

When `pdf-view-continuous' is non-nil, scrolling upward at the
bottom edge of the page moves to the next page.  Otherwise, go to
next page only on typing SPC (ARG is nil)."
  (interactive "P")
  (if (or pdf-view-continuous (null arg))
      (let ((hscroll (window-hscroll))
            (cur-page (pdf-view-current-page)))
        (when (or (= (window-vscroll) (image-scroll-up arg))
                  ;; Workaround rounding/off-by-one issues.
                  (memq pdf-view-display-size
                        '(fit-height fit-page)))
          (pdf-view-next-page 2)
          (when (/= cur-page (pdf-view-current-page))
            (image-bob)
            (image-bol 1))
          (set-window-hscroll (selected-window) hscroll)))
    (image-scroll-up arg)))

(defun my-pdf-view-double-scroll-horizontal-view ()
  (interactive)
  (my-pdf-view-double-scroll-up-or-next-page)
  (other-window 1)
  (my-pdf-view-double-scroll-up-or-next-page)
  (other-window 1))

The same technique could probably be used for #27 by additionally resizing the windows. Perhaps hiding the mode-line in the upper window would be a nice customization option as well, but I haven't figured out how to do that ( (setq mode-line-format nil) works on the buffer so it hides it from both windows).

These could probably even be combined, to have four windows open, where you can scroll vertically through the double-page view.

(defun my-pdf-view-double-scroll-vertical-view ()
  (interactive)
  (my-pdf-view-double-scroll-up-or-next-page)
  (shrink-window 1)
  (other-window 1)
  (my-pdf-view-double-scroll-up-or-next-page)
  (enlarge-window 1)
  (other-window 1))

I'm not familiar enough with pdf-tools' internals to make this "production ready", but I hope it helps.

A couple packages may be useful for ideas or code:

@dalanicolai
Copy link

@apnewberry Although I got the idea when I was reading about follow mode (Somehow I thought of buffers where they wrote windows), I now see that I have implemented your idea. So, great idea! Anyway, it has been realized now and works fine...

@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

3 participants