My screen is a bit small and dividing it in two vertically to see a pdf while editing it leaves a lot to be desired. However, if pdf-tools or pdf-view mode had the option to hide a % of the empty white margins for each page of the document it would fit just right. It is possible to do this?

PocketBook reader for android has this feature and you only see the parts of a pdf with actual characters on them.

bonus: It is possible to run pdf-view-fit-width-to-window automatically?

  • 4
    Try M-x pdf-view-auto-slice-minor-mode RET, and then W to fit to width.
    – Augusto
    Jan 12, 2020 at 18:52
  • Please submit this as a answer so I can properly mark it as resolved and give you the credit. Jan 12, 2020 at 19:52

1 Answer 1


Here is my configuration of pdf-tools using use-package. The relevant part to answer this question is the hook of pdf-view-auto-slice-minor-mode. Alternatively, a one liner would be (add-hook 'pdf-view-mode-hook 'pdf-view-auto-slice-minor-mode)

(use-package pdf-tools
  ;; :after (quelpa)
  :ensure t
  :magic ("%PDF" . pdf-view-mode)
  ;; default page width behaviour 
  :hook ((pdf-view-mode . pdf-view-auto-slice-minor-mode)
         (pdf-view-mode . pdf-continuous-scroll-mode)
  ;; use Ctrl+home/end keys to move to the first/last page
  :bind (:map pdf-view-mode-map
              ("C-5" . 'pdf-continuous-scroll-mode)
              ("<home>" . 'pdf-view-first-page)
              ("<end>" . 'pdf-view-last-page))
  ;; Print
  (setq pdf-misc-print-program "/usr/bin/lpr")
  (pdf-tools-install t)
  ;; Install pdf-continuous-scroll-mode
  (quelpa '(pdf-continuous-scroll-mode
            :fetcher github
            :repo "dalanicolai/pdf-continuous-scroll-mode.el")
  (require 'pdf-continuous-scroll-mode)
  (add-hook 'pdf-view-mode-hook 'pdf-continuous-scroll-mode)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.