README.md

April 12, 2025 ยท View on GitHub

EAF PDF Viewer

PDF Viewer application for the Emacs Application Framework.

Load application

Install EAF first, then add below code in your emacs config:

(add-to-list 'load-path "~/.emacs.d/site-lisp/emacs-application-framework/")
(require 'eaf)
(require 'eaf-pdf-viewer)

LaTeX config

(add-to-list 'TeX-command-list '("XeLaTeX" "%`xelatex --synctex=1%(mode)%' %t" TeX-run-TeX nil t))
(add-to-list 'TeX-view-program-list '("eaf" eaf-pdf-synctex-forward-view))
(add-to-list 'TeX-view-program-selection '(output-pdf "eaf"))

Double click the left button to edit backward.

Translate current word

Double click the right button to edit backward.

You need re-implement eaf-translate-text yourself.

SCR-20230805-ofva

The translation tool used in the screenshot is: popweb

Dark mode

Default set background color to emacs-background-color

Override this behavior

(setq eaf-pdf-dark-mode nil)

Dependency List

PackageDescription
python-pymupdfPDF rendering engine
libreofficeConvert doc file to pdf, optional

The keybinding of EAF PDF Viewer.

KeyEvent
jscroll_up
<down>scroll_up
C-nscroll_up
kscroll_down
<up>scroll_down
C-pscroll_down
hscroll_left
<left>scroll_left
C-bscroll_left
lscroll_right
<right>scroll_right
C-fscroll_right
SPCscroll_up_page
bscroll_down_page
C-vscroll_up_page
M-vscroll_down_page
ttoggle_read_mode
0zoom_reset
=zoom_in
-zoom_out
gscroll_to_begin
Gscroll_to_end
pjump_to_page
Pjump_to_percent
[save_current_pos
]jump_to_saved_pos
itoggle_inverted_mode
C-itoggle_inverted_image_mode
mtoggle_mark_link
fjump_to_link
M-wcopy_select
C-ssearch_text_forward
C-rsearch_text_backward
xclose_buffer
zeaf-ocr-buffer
C-<right>rotate_clockwise
C-<left>rotate_counterclockwise
M-hadd_annot_highlight
M-uadd_annot_underline
M-sadd_annot_squiggly
M-dadd_annot_strikeout_or_delete_annot
M-eadd_annot_text_or_edit_annot
M-ptoggle_presentation_mode
Jselect_left_tab
Kselect_right_tab
oeaf-pdf-outline
Oeaf-pdf-outline-edit
Ttoggle_trim_white_margin
C-ttoggle_last_position

Other Features and Customization

  • (eaf-pdf-narrow-search): full-document line-based search and live-preview with ivy (for both PDF and EPUB)

  • (eaf-pdf-narrow-search "toc"): search toc with ivy (for both PDF and EPUB)

    You can customize the search functions like this:

      (defun eaf-pdf-narrow-search-toc () (interactive) (eaf-pdf-narrow-search "toc"))
      (eaf-bind-key eaf-pdf-narrow-search-toc "C-o" eaf-pdf-viewer-keybinding)
      (eaf-bind-key eaf-pdf-narrow-search "/" eaf-pdf-viewer-keybinding)
    
  • left double click: open an emacs buffer filled with text of current page and jump to the corresponding line. (for EPUB and PDF when synctex failed)

  • set progress bar font size lively

  (setq eaf-pdf-show-progress-on-page 't) ;; default 24
  (setq eaf-pdf-show-progress-on-page nil) ;; hide progress bar
  (setq eaf-pdf-show-progress-on-page 20) ;; set font size to 20
  (setq eaf-pdf-show-progress-on-page 0) ;; hide progress bar
  • click after select to copy text
  (setq eaf-pdf-click-to-copy t) # ;; default nil