pdf.el (661B)
1 ;; -*- lexical-binding: t; -*- 2 ;;; Configuration for PDF related functionality 3 4 (use-package pdf-tools 5 :init (pdf-loader-install) 6 :config 7 (defun my/pdf-fit () 8 "Fit the window to the PDF's width and the PDF to the window's height. 9 From https://emacs.stackexchange.com/questions/60537/fit-window-to-pdf-upon-loading" 10 (interactive) 11 (let ((W (- (car (pdf-view-image-size)) (window-pixel-width)))) 12 (window-resize (get-buffer-window) (+ 10 W) t nil t) 13 (pdf-view-fit-height-to-window))) 14 :hook 15 ((pdf-view-mode . pdf-view-midnight-minor-mode) 16 (pdf-view-mode . hide-mode-line-mode) 17 (pdf-view-after-change-page . my/pdf-fit)))