Giter VIP home page Giter VIP logo

eaf-pdf-viewer's People

Contributors

c1-g avatar chaoxiaosu avatar chongqing520 avatar czqhurricnae avatar ginqi7 avatar gkowzan avatar heartnheart avatar hollowman6 avatar jdogzz avatar kollienne avatar lhpfvs avatar loyalpartner avatar luhuaei avatar lujun9972 avatar lyjdwh avatar mackong avatar manateelazycat avatar maskray avatar matthewzmd avatar mgcyung avatar qquanwei avatar smallzhan avatar taquangtrung avatar tumashu avatar wcq062821 avatar wi24rd avatar wsw0108 avatar xhcoding avatar zbelial avatar zsxh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

eaf-pdf-viewer's Issues

Can Pdf-viewer display a tool tip over the Pdf page to indicate the synchronized text?

Hi,

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

I'm using the feature that synchronizes from LaTeX file to PDF file (nice feature btw), and think that it would be very useful if Pdf-viewer can display a tooltip over the Pdf page to indicate the corresponding parts between Pdf and LaTeX files.

This feature is currently supported by pdf-tools: https://github.com/politza/pdf-tools/blob/c510442ab89c8a9e9881230eeb364f4663f59e76/lisp/pdf-sync.el#L675

Here is the screenshot of pdf-tools:

pdftool

It would be very nice if EAF Pdf-viewer can support it too.

Describe alternatives you've considered

I tried to bring the code from pdf-tools over EAF Pdf-viewer but wasn't successful.

PDF viewer does not update page count on reload

Describe the bug
If the number of pages in the PDF changes and the viewer reloads the PDF, it will reload it with the old number of pages, either making pages at the end inaccessible or showing empty blank space and throwing an error.

To Reproduce
Using AucTeX and the LaTeX package lipsum:

  1. Create a new TeX file called containing the following text:
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\end{document}
  1. Build the file and open the PDF in eaf-pdf-viewer. It should be 1 page long.
  2. Change the line lipsum[1] to lipsum[1-10].
  3. The PDF auto-reloads but only shows the first of 2 pages.
  4. Close and reopen the PDF in eaf-pdf-viewer. It should now show both pages.
  5. Now change the line lipsum[1-10] back to lipsum[1].
  6. Again, the PDF auto-reloads but now it is possible to scroll into the blank space beyond the first page. The *eaf* buffer displays:
Traceback (most recent call last):
  File "/home/pvankoughnett/.emacs.d/elpa/27.2/develop/eaf-20211104.2004/app/pdf-viewer/buffer.py", line 1019, in paintEvent
    qpixmap = self.get_page_pixmap(index, self.scale * hidpi_scale_factor, self.rotation)
  File "/home/pvankoughnett/.emacs.d/elpa/27.2/develop/eaf-20211104.2004/app/pdf-viewer/buffer.py", line 941, in get_page_pixmap
    page = self.document[index]
  File "/home/pvankoughnett/.emacs.d/elpa/27.2/develop/eaf-20211104.2004/app/pdf-viewer/buffer.py", line 398, in __getitem__
    page = PdfPage(self.document[index], index, self.document.isPDF)
  File "/home/pvankoughnett/.local/lib/python3.8/site-packages/fitz/fitz.py", line 5135, in __getitem__
    raise IndexError("page not in document")
IndexError: page not in document
QBackingStore::endPaint() called with active painter; did you forget to destroy it or call QPainter::end() on it?

Expected behavior
When reloading the file, eaf-pdf-viewer should re-check its page count and display the file appropriately.

Versions (please complete the following info):

  • Distro and DE/WM: Ubuntu/Gnome
  • Versions of Dependencies: eaf-20211104.2004
  • M-x emacs-version: GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2021-11-05; using Spacemacs v.0.300.0.

pdf添加标注报错

Describe the bug
当给pdf添加高亮,下划线,波浪线等等标注时,报如下错误

Traceback (most recent call last):
  File "/home/liuyan/bin/eaf/eaf.py", line 368, in eval_function
    getattr(buffer, function_name)()
  File "/home/liuyan/bin/eaf/app/pdf-viewer/eaf_pdf_buffer.py", line 242, in add_annot_highlight
    self.buffer_widget.annot_select_char_area("highlight")
  File "/home/liuyan/bin/eaf/app/pdf-viewer/eaf_pdf_widget.py", line 895, in annot_select_char_area
    new_annot = page.addHighlightAnnot(quads)
  File "/home/liuyan/bin/eaf/app/pdf-viewer/eaf_pdf_page.py", line 92, in __getattr__
    return getattr(self.page, attr)
AttributeError: 'Page' object has no attribute 'addHighlightAnnot'
Traceback (most recent call last):
  File "/home/liuyan/bin/eaf/eaf.py", line 368, in eval_function
    getattr(buffer, function_name)()
  File "/home/liuyan/bin/eaf/app/pdf-viewer/eaf_pdf_buffer.py", line 256, in add_annot_squiggly
    self.buffer_widget.annot_select_char_area("squiggly")
  File "/home/liuyan/bin/eaf/app/pdf-viewer/eaf_pdf_widget.py", line 907, in annot_select_char_area
    new_annot = page.addSquigglyAnnot(quads)
  File "/home/liuyan/bin/eaf/app/pdf-viewer/eaf_pdf_page.py", line 92, in __getattr__
    return getattr(self.page, attr)
AttributeError: 'Page' object has no attribute 'addSquigglyAnnot'

To Reproduce

打开一个pdf文件,选择文本,标注(高亮,下划线。。。)

Expected behavior

能够正确标注

Versions (please complete the following info):

  • Distro and DE/WM: manjaro dwm
  • Versions of Dependencies: 最新
  • M-x emacs-version: GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6) of 2022-06-26

Page scrolling bug in single-page display mode

Describe the bug
I am using eaf with emacs 28.1 on windows 11.
eaf is the latest version as of 4/11.

When read_mode is set to fit_to_presentation, the pdf screen display does not change even if the page number displayed in the lower right corner of the screen changes, and vice versa.

Also, when a pdf file is opened with read_mode set to fit_to_presentation, scroll_up_page and scroll_down_page do not work frequently.

Screenshots
Animation
Animation2
Animation3

When adding annotations in the `follow` background mode, EAF pdf-viewer incorrectly saves background color of pages containing annotation.

Hi,

Describe the bug

I use the dark theme background mode and configured EAF pdf-viewer in the follow background mode.

When adding a highlight annotation and saving it to the PDF file by M-h, the background of the corresponding page is also saved as the current dark theme background of Emacs.

To Reproduce

  • Open a PDF file by EAF pdf-viewer in Emacs with dark theme background and follow background mode.

  • Use mouse to select a text, and then press M-h to highlight it.

  • Open the PDF file by an external PDF viewer, such as Okular, then you can see that the background of the PDF page containing the annotation is charged (see attached screenshot)

Expected behavior

The page background should not be changed.

Versions (please complete the following info):

  • Distro and DE/WM: Linux Mint XFCE 20.02
  • Versions of Dependencies: EAF pdf-reviewer revision: 100d1cd
  • M-x emacs-version: 28.05

Screenshots

The background of the last two pages is changed. They should not be.

pdf-theme

Search does not work

Traceback (most recent call last):
  File "/home/xx/.emacs.d.spacemacs/elpa-stable/28.0/develop/eaf-20220401.1719/core/utils.py", line 50, in on_signal_received
    self._func(obj, *args, **kwargs)
  File "/home/xx/.emacs.d.spacemacs/elpa/28.0/develop/eaf-20220401.1719/eaf.py", line 386, in handle_input_response
    buffer.handle_input_response(callback_tag, callback_result)
  File "/home/xx/.emacs.d.spacemacs/elpa/28.0/develop/eaf-20220401.1719/app/pdf-viewer/eaf_pdf_buffer.py", line 134, in handle_input_response
    self.buffer_widget.search_text(str(result_content))
  File "/home/xx/.emacs.d.spacemacs/elpa/28.0/develop/eaf-20220401.1719/app/pdf-viewer/eaf_pdf_widget.py", line 798, in search_text
    quads_list = self.document.search_page_for(page_index, text, hit_max=999, quads=True)
TypeError: search_page_for() got an unexpected keyword argument 'hit_max'

Describe the bug
A clear and concise description of what the bug is.

C-s does nothing. *eaf* buffer shows the above error.

To Reproduce
Ensure you're on the latest master branch, then note the steps to reproduce the behavior.

Hit C-s

Expected behavior
A clear and concise description of what you expected to happen.

Successful search.

Versions (please complete the following info):

  • Distro and DE/WM: archlinux, KDE
  • Versions of Dependencies: qt5-legacy (should reproduce on master)
  • M-x emacs-version: GNU Emacs 28.0.92 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.4) of 2022-03-23

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
pymupdf doc says hit_max is dropped since v1.18.2.

Black background of pdf file in the white theme

Up-to-date EAF and dependencies installed
Manjaro kde
Emacs 28.06
eaf :
Deprecation: 'pageCropBox' removed from class 'Document' after v1.19.0 - use 'page_cropbox'. Deprecation: 'setCropBox' removed from class 'Page' after v1.19.0 - use 'set_cropbox'. Deprecation: 'getText' removed from class 'Page' after v1.19.0 - use 'get_text'. Deprecation: 'setRotation' removed from class 'Page' after v1.19.0 - use 'set_rotation'. Deprecation: 'getPixmap' removed from class 'Page' after v1.19.0 - use 'get_pixmap'.

As the title says, how can I change the black bg to be consistent with my light theme? Thank you!

Screenshots
image

When in presentation mode, scroll_*_page doesn't work

In presentation mode (M-p), scroll_*_page functions don't do anything (expected result: these should scroll a page), because the amount of scrolling is not calculated correctly, in the expression self.rect().height() - self.scroll_step_vertical, the two terms cancel each other out.

I could fix this issue by this simple hack, because scroll_up and scroll_down do work correctly:

    @interactive
    def scroll_up_page(self):
        # Adjust scroll step to make users continue reading fluently.
        if self.presentation_mode:
            self.scroll_up()
        else:
            self.update_vertical_offset(min(self.scroll_offset + self.rect().height() - self.scroll_step_vertical, self.max_scroll_offset()))

    @interactive
    def scroll_down_page(self):
        # Adjust scroll step to make users continue reading fluently.
        if self.presentation_mode:
            self.scroll_down()
        else:
            self.update_vertical_offset(max(self.scroll_offset - self.rect().height() + self.scroll_step_vertical, 0))

eaf-pdf-viewer cannot open PDF compiled from LaTex when changes are made

Run git pull and .install-eaf.py and the problem persists.

Describe the bug

EAF-pdf-viewer can successfully open if the LaTex file is compiled for the first time. But it cannot be reopened when the LaTex file is changed and recompiled.

To Reproduce

  • Open a LaTex file and compile it.
  • Make a random change to the LaTex file and then re-compile it

Expected behavior

PDF file is reopened with the newest changes.

Versions (please complete the following info):

  • Distro and DE/WM: Ubuntu 22.04 with WSL 2
  • Versions of Dependencies:
  • M-x emacs-version: GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2022-05-31

Additional context
I am running Spacemacs with the following lines added to my .spacemacs file under (defun dotspacemacs/user-config ()

  ;; Make EAF-PDF the default viewer for Tex PDF export
  (require 'auctex-latexmk)
  (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"))

** Error message in the Message buffer
error in process sentinel: eaf-epc-net-send: Process epc con 4 not running error in process sentinel: Process epc con 4 not running

** Error message in the eaf buffer

Failed to watch callback
Traceback (most recent call last):
  File "/home/xsl/.emacs.d/elpa/28.1/develop/eaf-20220826.26/app/pdf-viewer/eaf_pdf_widget.py", line 376, in paintEvent
    qpixmap = self.get_page_pixmap(index, self.scale * hidpi_scale_factor, self.rotation)
  File "/home/xsl/.emacs.d/elpa/28.1/develop/eaf-20220826.26/app/pdf-viewer/eaf_pdf_widget.py", line 296, in get_page_pixmap
    page = self.document[index]
  File "/home/xsl/.emacs.d/elpa/28.1/develop/eaf-20220826.26/app/pdf-viewer/eaf_pdf_document.py", line 59, in __getitem__
    page = PdfPage(self.document[index], index, self.document.is_pdf)
  File "/home/xsl/.local/lib/python3.9/site-packages/fitz/fitz.py", line 5357, in __getitem__
    raise IndexError("page not in document")
IndexError: page not in document

Process *eaf* aborted

选中区域后区域里的内容消失

*eaf* 中没有任何信息

Describe the bug
用鼠标选中区域后,区域会消失,如图所示:

test

To Reproduce
如图所示

Expected behavior
区域不消失

Versions (please complete the following info):

  • Distro and DE/WM: Manjaro 23.1.2
  • Versions of Dependencies:
  • M-x emacs-version: 29.1

配置如下

(use-package eaf-pdf-viewer
  :straight nil
  :init
  (require 'eaf-pdf-viewer)
  (setq eaf-pdf-dark-mode nil)
  )

Additional context
测试的 pdf 是 https://web.mit.edu/~simsong/www/ugh.pdf

hover annot not working

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Ensure you're on the latest master branch, then note the steps to reproduce the behavior.

Expected behavior
When I move cursor to above annot, can press M-D delete annot

Versions (please complete the following info):

  • Distro and DE/WM:
  • Versions of Dependencies:
  • M-x emacs-version:
    GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0)

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

pdf annotations export

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
No
Describe the solution you'd like
A clear and concise description of what you want to happen.
pdf annotatios export to org-mode
Describe alternatives you've considered
A clear and concise description of an alternative solutions or features you've considered, if any.

Additional context
Add any other context or screenshots about the feature request here.

Consider supporting occur searches

Describe the solution you'd like
I wonder if EAF has a way to support occur-mode. The use cases are as follows: EAF already supports incremental search similar to iSearch, which is fast and has a good experience, but it takes a jump forward to know if it is the search place you need.

Sometimes we may prefer to choose from a series of search results (such as Blink-Search or Consult does).

Describe alternatives you've considered
Pdf-tools does a similar job:
For example, when I wanted to know how to measure performance, so I searched "measure performance", I got a list of results, and I could jump back and forth at will with follow-mode on the right.
image

And I think this one is useful not only for reading pdfs, but also for eaf-browsers(such as occur on current page) etc, we could get a global-view and just pick someone.

Thanks for the wonderful eaf-project!
Season's greetings.

Pdf viewer: support two-ways synctex integration

Hi and congratulations for this amazing package, I'm blown away. The pdf viewer is great, but I'm missing synctex integration. This is in two parts: first, jump from a latex buffer to the position in the pdf, and second jump from a pdf to the latex buffer

Support undo/redo actions

Hi,

Is your feature request related to a problem? Please describe.

Currently, if I accidentally delete a note, there is no feature to undo my action, hence I cannot recover the note.

Describe the solution you'd like

It would be nice if EAF pdf-viewer can support undo/redo action.

(However, I think it is quite challenging to implement as we need to maintain a state of action sequences)

How to make Emacs stay in LaTeX buffer after doing a sync-tex-backward-edit from EAF pdf-viewer?

Hi,

Is your feature request related to a problem? Please describe.

When I use EAF pdf-viewer to open a PDF file generated by LaTeX, and double-click on the PDF file, I see that EAF pdf-viewer can synchronize backward to the corresponding LaTeX buffer: it opens the LaTeX buffer and locate to the corresponding line of LaTeX source code.

However, after Emacs jumps to the LaTeX buffer, it immediately jumps back to the EAF pdf-viewer buffer.

Describe the solution you'd like

Is there a way to make Emacs stays in the LaTeX buffer?

Describe alternatives you've considered

I looked into the code of buffer.py in EAF pdf-viewer and see that the function below is called:

eval_in_emacs("eaf-pdf-synctex-backward-edit", [self.url, page_index + 1, ex, ey])

and eaf-pdf-synctex-backward-edit does select the buffer correctly.

However, I don't know why after executing eval_in_emacs, the EAF pdf-viewer window is selected again.

Support inline text annotation in PDF file

Hi,

Is your feature request related to a problem? Please describe.

It would be very nice if EAF pdf-viewer can also support inline text annotation. With this feature, I think it will become as good as the existing PDF viewers in Linux.

Describe alternatives you've considered

I look at existing features, and EAF pdf-viewer seems to support only popup text annotation.

Single page viewing

Very fast and very nice viewer. But, wondering if a new feature is possible, since it makes, in my opinion, viewing a pdf presentation much easier.

I would like to force EOF to only show 1 page in the pdf file at a time, and then have a keystrokes that let you move up 1 page, or down 1 page. Right now the "page" movement slowly shifts such that you are looking in the middle of pages.

Thanks!

Can not jump to page with outline

  • If EAF was working correctly until a recent git pull, please refer to Mandatory Procedures to Keep Your EAF Up-to-Date first.
  • Please check the *eaf* buffer, if there is any error shown in the *eaf* buffer, paste it here.
    Traceback (most recent call last):
    File "/home/dn/.emacs.d/site-lisp/emacs-application-framework/eaf.py", line 384, in call_function_with_args
    return str(self.buffer_dict[buffer_id].call_function_with_args(function_name, *args, **kwargs))
    File "/home/dn/.emacs.d/site-lisp/emacs-application-framework/core/buffer.py", line 341, in call_function_with_args
    return getattr(self, function_name)(*args, **kwargs)
    AttributeError: 'AppBuffer' object has no attribute 'jump_to_page_with_num'
    Describe the bug
    A clear and concise description of what the bug is.
    can not jump through the outline.
    To Reproduce
    Ensure you're on the latest master branch, then note the steps to reproduce the behavior.
  1. Open a pdf file.
  2. press o open the pdf outline.
  3. press enter on one section.
    Expected behavior
    A clear and concise description of what you expected to happen.

Versions (please complete the following info):

  • Distro and DE/WM:
  • Versions of Dependencies:
  • M-x emacs-version:

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

the pdf annot doesn't work with pymupdf 1.19.x

Describe the bug

After upgrading pymupdf to 1.19.x, pdf-viewer cannot select text to annot.

To Reproduce

pip install pymupdf --upgrade

then annot through eaf-pdf-viewer.

Expected behavior

the text can be selected and annoted.

Versions (please complete the following info):

  • Distro and DE/WM: manjaro dwm
  • Versions of Dependencies: pymupdf==1.19.x
  • M-x emacs-version: GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.17.4) of 2021-12-05

页面跳转不准确

Describe the bug
不论是使用快捷键 p,输入跳转所需页面数字,还是 pdfgrep 预览调用,都不能准确跳转到目标页面。

eaf-pdf-jump-to-page

Versions (please complete the following info):
eaf-pdf-viewer 版本:f9a96b5 master origin/master grafted New render translate code is wrong, revert to previous version.

Screenshots
截屏2022-12-22 23 34 10

Error pdf trought ssh

Describe the bug
Unable to open pdf through ssh connection. The same pdf is correctly opened from local. This is the tracebug from the eaf buffer:

Saved session:  /home/r/.emacs.d/elpa/27.2/develop/eaf-20220629.133/app/pdf-viewer/eaf_pdf_buffer.py /home/r/Downloads/GC_analysis.pdf 0:2.69281045751634:fit_to_width:True:0
Traceback (most recent call last):
  File "/home/r/.emacs.d/elpa/27.2/develop/eaf-20220629.133/app/pdf-viewer/eaf_pdf_widget.py", line 338, in resizeEvent
    self.update_scale()
  File "/home/r/.emacs.d/elpa/27.2/develop/eaf-20220629.133/app/pdf-viewer/eaf_pdf_widget.py", line 540, in update_scale
    self.scale_to_width()
  File "/home/r/.emacs.d/elpa/27.2/develop/eaf-20220629.133/app/pdf-viewer/eaf_pdf_widget.py", line 533, in scale_to_width
    self.scale_to(self.rect().width() * 1.0 / self.page_width)
AttributeError: 'PdfViewerWidget' object has no attribute 'page_width'
Traceback (most recent call last):
  File "/home/r/.emacs.d/elpa/27.2/develop/eaf-20220629.133/app/pdf-viewer/eaf_pdf_widget.py", line 338, in resizeEvent
    self.update_scale()
  File "/home/r/.emacs.d/elpa/27.2/develop/eaf-20220629.133/app/pdf-viewer/eaf_pdf_widget.py", line 540, in update_scale
    self.scale_to_width()
  File "/home/r/.emacs.d/elpa/27.2/develop/eaf-20220629.133/app/pdf-viewer/eaf_pdf_widget.py", line 533, in scale_to_width
    self.scale_to(self.rect().width() * 1.0 / self.page_width)
AttributeError: 'PdfViewerWidget' object has no attribute 'page_width'

Process *eaf* aborted (core dumped)

Versions (please complete the following info):

  • Distro and DE/WM: Fedora Linux 36, Gnome 42.3 (Wayland), remote is Debian 11
  • Versions of Dependencies: eaf-20220629.133
  • M-x emacs-version: GNU Emacs 27.2 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.31, cairo version 1.17.4) of 2022-03-24

Crash with specific file

Describe the bug
The PDF viewer crashes as I scroll to the second page of specific pdf file. The file can be downloaded from here https://electrovolt.ir/wp-content/uploads/2014/08/Design-of-Analog-CMOS-Integrated-Circuit-2nd-Edition-ElectroVolt.ir_.pdf

To Reproduce
Minimal configurations with emacs -Q

;; setup packages
(package-initialize)
(add-to-list 'load-path
             (concat user-emacs-directory
                     "site-packages/eaf"))
(setq eaf-python-command "/usr/bin/python3")
(require 'eaf)
(require 'eaf-pdf-viewer)
(require 'eaf-system-monitor)
(require 'eaf-image-viewer)
(require 'eaf-markdown-previewer)
(require 'eaf-org-previewer)
(require 'eaf-file-manager)

Open the pdf file above, scroll to the second page. The pdf-viewer would crash.

I found a similar issue here. My pdf-browser is on the commit 4f889e4 and my py-mupdf version is 1.19.6-1. Both dependencies are seem to have fixed the bug metioned in the previous issue.
Versions (please complete the following info):

  • Distro and DE/WM: i3wm
  • Versions of Dependencies:
local/python-pyqt6 6.3.0-1 (pyqt6)
   A set of Python bindings for the Qt6 toolkit
local/python-pyqt6-sip 13.3.1-1
   The sip module support for PyQt6
local/python-pyqt6-webengine 6.3.0-1 (pyqt6)
   Python bindings for QtWebEngine
local/python-pymupdf 1.19.6-1
   Python bindings for MuPDF's rendering library
local/libmupdf 1.19.1-1
   Library for Lightweight PDF and XPS viewer

EAF core and pdf viewer are on master branch.

  • M-x emacs-version: 28.0.92

Additional context
The log file is shown here

Traceback (most recent call last):
  File "/home/shrubbroom/.emacs.d/site-packages/eaf/app/pdf-viewer/eaf_pdf_widget.py", line 374, in paintEvent
    qpixmap = self.get_page_pixmap(index, self.scale * hidpi_scale_factor, self.rotation)
  File "/home/shrubbroom/.emacs.d/site-packages/eaf/app/pdf-viewer/eaf_pdf_widget.py", line 295, in get_page_pixmap
    page = self.document[index]
  File "/home/shrubbroom/.emacs.d/site-packages/eaf/app/pdf-viewer/eaf_pdf_document.py", line 59, in __getitem__
    page = PdfPage(self.document[index], index, self.document.isPDF)
  File "/home/shrubbroom/.emacs.d/site-packages/eaf/app/pdf-viewer/eaf_pdf_page.py", line 84, in __init__
    self._page_rawdict = self._init_page_rawdict()
  File "/home/shrubbroom/.emacs.d/site-packages/eaf/app/pdf-viewer/eaf_pdf_page.py", line 99, in _init_page_rawdict
    set_page_crop_box(self.page)(self.clip)
  File "/usr/lib/python3.10/site-packages/fitz/fitz.py", line 6649, in set_cropbox
    return self._set_pagebox("CropBox", rect)
  File "/usr/lib/python3.10/site-packages/fitz/fitz.py", line 6644, in _set_pagebox
    raise ValueError("rect not in mediabox")
ValueError: rect not in mediabox

Process *eaf* aborted (core dumped)
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffd68fa640 (LWP 220218)]
[New Thread 0x7fffd5eb1640 (LWP 220219)]
[New Thread 0x7fffd52c0640 (LWP 220220)]
[New Thread 0x7fffce572640 (LWP 220221)]
[New Thread 0x7fffcdbe2640 (LWP 220222)]
[New Thread 0x7fffcd252640 (LWP 220223)]
[New Thread 0x7fffc16e9640 (LWP 220224)]
[New Thread 0x7fffc0d59640 (LWP 220225)]
[New Thread 0x7fffabfff640 (LWP 220226)]
[New Thread 0x7fffab66f640 (LWP 220227)]
[New Thread 0x7fffaacdf640 (LWP 220228)]
[New Thread 0x7fffaa34f640 (LWP 220229)]
[New Thread 0x7fffa99bf640 (LWP 220230)]
[New Thread 0x7fffa902f640 (LWP 220231)]
[New Thread 0x7fff8bfff640 (LWP 220232)]
[New Thread 0x7fff83fff640 (LWP 220233)]
[New Thread 0x7fff8b66f640 (LWP 220234)]
[New Thread 0x7fff8acdf640 (LWP 220235)]
[New Thread 0x7fff8a34f640 (LWP 220236)]
[New Thread 0x7fff899bf640 (LWP 220237)]
[New Thread 0x7fff8902f640 (LWP 220238)]
[Thread 0x7fff8902f640 (LWP 220238) exited]
[New Thread 0x7fff8902f640 (LWP 220239)]
[New Thread 0x7fff8366f640 (LWP 220240)]
[New Thread 0x7fff82cdf640 (LWP 220241)]
[New Thread 0x7fff8234f640 (LWP 220242)]
[Thread 0x7fff8234f640 (LWP 220242) exited]
[New Thread 0x7fff8234f640 (LWP 220243)]
[Thread 0x7fff82cdf640 (LWP 220241) exited]
[Thread 0x7fff8234f640 (LWP 220243) exited]
[New Thread 0x7fff8234f640 (LWP 220244)]
[Thread 0x7fff8234f640 (LWP 220244) exited]
[New Thread 0x7fff8234f640 (LWP 220245)]
[Thread 0x7fff8234f640 (LWP 220245) exited]
[New Thread 0x7fff8234f640 (LWP 220246)]
[Thread 0x7fff8234f640 (LWP 220246) exited]
[New Thread 0x7fff8234f640 (LWP 220247)]
[Thread 0x7fff8234f640 (LWP 220247) exited]
[New Thread 0x7fff8234f640 (LWP 220248)]
[Thread 0x7fff8234f640 (LWP 220248) exited]
[New Thread 0x7fff8234f640 (LWP 220249)]
[Thread 0x7fff8234f640 (LWP 220249) exited]
[New Thread 0x7fff8234f640 (LWP 220250)]
[Thread 0x7fff8234f640 (LWP 220250) exited]
[New Thread 0x7fff8234f640 (LWP 220251)]
[Thread 0x7fff8234f640 (LWP 220251) exited]
[New Thread 0x7fff8234f640 (LWP 220252)]
[Thread 0x7fff8234f640 (LWP 220252) exited]
[New Thread 0x7fff8234f640 (LWP 220253)]
[Thread 0x7fff8234f640 (LWP 220253) exited]
[New Thread 0x7fff8234f640 (LWP 220254)]
[Thread 0x7fff8234f640 (LWP 220254) exited]
[New Thread 0x7fff8234f640 (LWP 220255)]
[Thread 0x7fff8234f640 (LWP 220255) exited]
[New Thread 0x7fff8234f640 (LWP 220256)]
[Thread 0x7fff8234f640 (LWP 220256) exited]
[New Thread 0x7fff8234f640 (LWP 220257)]
[Thread 0x7fff8234f640 (LWP 220257) exited]
[New Thread 0x7fff8234f640 (LWP 220258)]
[Thread 0x7fff8234f640 (LWP 220258) exited]
[New Thread 0x7fff8234f640 (LWP 220259)]
[Thread 0x7fff8234f640 (LWP 220259) exited]
[New Thread 0x7fff8234f640 (LWP 220260)]
[Thread 0x7fff8234f640 (LWP 220260) exited]
[New Thread 0x7fff8234f640 (LWP 220261)]
[Thread 0x7fff8234f640 (LWP 220261) exited]
[New Thread 0x7fff8234f640 (LWP 220278)]
[Thread 0x7fff8234f640 (LWP 220278) exited]
[New Thread 0x7fff8234f640 (LWP 220279)]
[Thread 0x7fff8234f640 (LWP 220279) exited]
[New Thread 0x7fff8234f640 (LWP 220282)]
[Thread 0x7fff8234f640 (LWP 220282) exited]
[New Thread 0x7fff8234f640 (LWP 220283)]
[Thread 0x7fff8234f640 (LWP 220283) exited]
[New Thread 0x7fff8234f640 (LWP 220284)]
[Thread 0x7fff8234f640 (LWP 220284) exited]
[New Thread 0x7fff8234f640 (LWP 220285)]
[Thread 0x7fff8234f640 (LWP 220285) exited]
[New Thread 0x7fff8234f640 (LWP 220286)]
[Thread 0x7fff8234f640 (LWP 220286) exited]
[New Thread 0x7fff8234f640 (LWP 220287)]
[Thread 0x7fff8234f640 (LWP 220287) exited]
[New Thread 0x7fff8234f640 (LWP 220288)]
[Thread 0x7fff8234f640 (LWP 220288) exited]
[New Thread 0x7fff8234f640 (LWP 220289)]
[Thread 0x7fff8234f640 (LWP 220289) exited]
[New Thread 0x7fff8234f640 (LWP 220290)]
[Thread 0x7fff8234f640 (LWP 220290) exited]
[New Thread 0x7fff8234f640 (LWP 220291)]
[Thread 0x7fff8234f640 (LWP 220291) exited]
[New Thread 0x7fff8234f640 (LWP 220292)]
[Thread 0x7fff8234f640 (LWP 220292) exited]
[New Thread 0x7fff8234f640 (LWP 220293)]
[Thread 0x7fff8234f640 (LWP 220293) exited]
[New Thread 0x7fff8234f640 (LWP 220294)]
[Thread 0x7fff8234f640 (LWP 220294) exited]
[New Thread 0x7fff8234f640 (LWP 220295)]
[Thread 0x7fff8234f640 (LWP 220295) exited]
[New Thread 0x7fff8234f640 (LWP 220296)]
[Thread 0x7fff8234f640 (LWP 220296) exited]
[New Thread 0x7fff8234f640 (LWP 220297)]
[Thread 0x7fff8234f640 (LWP 220297) exited]
[New Thread 0x7fff8234f640 (LWP 220298)]
[Thread 0x7fff8234f640 (LWP 220298) exited]
[New Thread 0x7fff8234f640 (LWP 220299)]
[Thread 0x7fff8234f640 (LWP 220299) exited]
[New Thread 0x7fff8234f640 (LWP 220300)]
[Thread 0x7fff8234f640 (LWP 220300) exited]
[New Thread 0x7fff8234f640 (LWP 220302)]
[Thread 0x7fff8234f640 (LWP 220302) exited]
[New Thread 0x7fff8234f640 (LWP 220303)]
[Thread 0x7fff8234f640 (LWP 220303) exited]
[New Thread 0x7fff8234f640 (LWP 220304)]
[Thread 0x7fff8234f640 (LWP 220304) exited]
[New Thread 0x7fff8234f640 (LWP 220305)]
[Thread 0x7fff8234f640 (LWP 220305) exited]
[New Thread 0x7fff8234f640 (LWP 220306)]
[Thread 0x7fff8234f640 (LWP 220306) exited]
[New Thread 0x7fff8234f640 (LWP 220307)]
[Thread 0x7fff8234f640 (LWP 220307) exited]
[New Thread 0x7fff8234f640 (LWP 220308)]
[Thread 0x7fff8234f640 (LWP 220308) exited]
[New Thread 0x7fff8234f640 (LWP 220309)]
[Thread 0x7fff8234f640 (LWP 220309) exited]
[New Thread 0x7fff8234f640 (LWP 220310)]
[Thread 0x7fff8234f640 (LWP 220310) exited]
[New Thread 0x7fff8234f640 (LWP 220311)]
[Thread 0x7fff8234f640 (LWP 220311) exited]
[New Thread 0x7fff8234f640 (LWP 220312)]
[Thread 0x7fff8234f640 (LWP 220312) exited]
[New Thread 0x7fff8234f640 (LWP 220313)]
[Thread 0x7fff8234f640 (LWP 220313) exited]
[New Thread 0x7fff8234f640 (LWP 220314)]
[Thread 0x7fff8234f640 (LWP 220314) exited]
[New Thread 0x7fff8234f640 (LWP 220315)]
[Thread 0x7fff8234f640 (LWP 220315) exited]
[New Thread 0x7fff8234f640 (LWP 220316)]
[Thread 0x7fff8234f640 (LWP 220316) exited]
[New Thread 0x7fff8234f640 (LWP 220317)]
[Thread 0x7fff8234f640 (LWP 220317) exited]
[New Thread 0x7fff8234f640 (LWP 220318)]
[Thread 0x7fff8234f640 (LWP 220318) exited]
[New Thread 0x7fff8234f640 (LWP 220319)]
[Thread 0x7fff8234f640 (LWP 220319) exited]
[New Thread 0x7fff8234f640 (LWP 220320)]
[Thread 0x7fff8234f640 (LWP 220320) exited]
[New Thread 0x7fff8234f640 (LWP 220321)]
[Thread 0x7fff8234f640 (LWP 220321) exited]
[New Thread 0x7fff8234f640 (LWP 220322)]
[Thread 0x7fff8234f640 (LWP 220322) exited]
[New Thread 0x7fff8234f640 (LWP 220323)]
[Thread 0x7fff8234f640 (LWP 220323) exited]
[New Thread 0x7fff8234f640 (LWP 220324)]
[Thread 0x7fff8234f640 (LWP 220324) exited]
[New Thread 0x7fff8234f640 (LWP 220325)]
[Thread 0x7fff8234f640 (LWP 220325) exited]
[New Thread 0x7fff8234f640 (LWP 220326)]
[Thread 0x7fff8234f640 (LWP 220326) exited]
[New Thread 0x7fff8234f640 (LWP 220327)]
[Thread 0x7fff8234f640 (LWP 220327) exited]
[New Thread 0x7fff8234f640 (LWP 220328)]
[Thread 0x7fff8234f640 (LWP 220328) exited]
[New Thread 0x7fff8234f640 (LWP 220329)]
[Thread 0x7fff8234f640 (LWP 220329) exited]
[New Thread 0x7fff8234f640 (LWP 220330)]
[Thread 0x7fff8234f640 (LWP 220330) exited]
[New Thread 0x7fff8234f640 (LWP 220331)]
[New Thread 0x7fff82cdf640 (LWP 220332)]
[Thread 0x7fff82cdf640 (LWP 220332) exited]
[Thread 0x7fff8234f640 (LWP 220331) exited]
Traceback (most recent call last):
  File "/home/shrubbroom/.emacs.d/site-packages/eaf/app/pdf-viewer/eaf_pdf_widget.py", line 374, in paintEvent
    qpixmap = self.get_page_pixmap(index, self.scale * hidpi_scale_factor, self.rotation)
  File "/home/shrubbroom/.emacs.d/site-packages/eaf/app/pdf-viewer/eaf_pdf_widget.py", line 295, in get_page_pixmap
    page = self.document[index]
  File "/home/shrubbroom/.emacs.d/site-packages/eaf/app/pdf-viewer/eaf_pdf_document.py", line 59, in __getitem__
    page = PdfPage(self.document[index], index, self.document.isPDF)
  File "/home/shrubbroom/.emacs.d/site-packages/eaf/app/pdf-viewer/eaf_pdf_page.py", line 84, in __init__
    self._page_rawdict = self._init_page_rawdict()
  File "/home/shrubbroom/.emacs.d/site-packages/eaf/app/pdf-viewer/eaf_pdf_page.py", line 99, in _init_page_rawdict
    set_page_crop_box(self.page)(self.clip)
  File "/usr/lib/python3.10/site-packages/fitz/fitz.py", line 6649, in set_cropbox
    return self._set_pagebox("CropBox", rect)
  File "/usr/lib/python3.10/site-packages/fitz/fitz.py", line 6644, in _set_pagebox
    raise ValueError("rect not in mediabox")
ValueError: rect not in mediabox

Thread 1 "python3" received signal SIGABRT, Aborted.
0x00007ffff7a6234c in __pthread_kill_implementation () from /usr/lib/libc.so.6
#0  0x00007ffff7a6234c in __pthread_kill_implementation () at /usr/lib/libc.so.6
#1  0x00007ffff7a154b8 in raise () at /usr/lib/libc.so.6
#2  0x00007ffff79ff534 in abort () at /usr/lib/libc.so.6
#3  0x00007fffeb06d071 in  () at /usr/lib/libQt6Core.so.6
#4  0x00007fffeb06d3a5 in qt_assert(char const*, char const*, int) () at /usr/lib/libQt6Core.so.6
#5  0x00007fffd7d14272 in  () at /usr/lib/python3.10/site-packages/PyQt6/QtCore.abi3.so
#6  0x00007fffd7e34b28 in  () at /usr/lib/python3.10/site-packages/PyQt6/sip.cpython-310-x86_64-linux-gnu.so
#7  0x00007fffd76bc3ca in  () at /usr/lib/python3.10/site-packages/PyQt6/QtWidgets.abi3.so
#8  0x00007ffff695240e in QWidget::event(QEvent*) () at /usr/lib/libQt6Widgets.so.6
#9  0x00007fffd76bc95c in  () at /usr/lib/python3.10/site-packages/PyQt6/QtWidgets.abi3.so
#10 0x00007ffff690db5d in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6
#11 0x00007fffd7691c57 in  () at /usr/lib/python3.10/site-packages/PyQt6/QtWidgets.abi3.so
#12 0x00007fffeb0f143a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6
#13 0x00007ffff6941d3c in QWidgetPrivate::sendPaintEvent(QRegion const&) () at /usr/lib/libQt6Widgets.so.6
#14 0x00007ffff6943b1c in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter*, QWidgetRepaintManager*) () at /usr/lib/libQt6Widgets.so.6
#15 0x00007ffff69460ef in QWidgetPrivate::render(QPaintDevice*, QPoint const&, QRegion const&, QFlags<QWidget::RenderFlag>) () at /usr/lib/libQt6Widgets.so.6
#16 0x00007ffff6946539 in QWidget::render(QPainter*, QPoint const&, QRegion const&, QFlags<QWidget::RenderFlag>) () at /usr/lib/libQt6Widgets.so.6
#17 0x00007ffff6c79636 in QGraphicsProxyWidget::paint(QPainter*, QStyleOptionGraphicsItem const*, QWidget*) () at /usr/lib/libQt6Widgets.so.6
#18 0x00007ffff6ca0828 in  () at /usr/lib/libQt6Widgets.so.6
#19 0x00007ffff6c8baa8 in  () at /usr/lib/libQt6Widgets.so.6
#20 0x00007ffff6c8c5e9 in  () at /usr/lib/libQt6Widgets.so.6
#21 0x00007ffff6cbcc17 in QGraphicsView::paintEvent(QPaintEvent*) () at /usr/lib/libQt6Widgets.so.6
#22 0x00007fffd75b5b04 in  () at /usr/lib/python3.10/site-packages/PyQt6/QtWidgets.abi3.so
#23 0x00007ffff695240e in QWidget::event(QEvent*) () at /usr/lib/libQt6Widgets.so.6
#24 0x00007ffff69dc7e7 in QFrame::event(QEvent*) () at /usr/lib/libQt6Widgets.so.6
#25 0x00007fffd75b69cc in  () at /usr/lib/python3.10/site-packages/PyQt6/QtWidgets.abi3.so
#26 0x00007fffeb0f0470 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6
#27 0x00007ffff690db4c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6
#28 0x00007fffd7691c57 in  () at /usr/lib/python3.10/site-packages/PyQt6/QtWidgets.abi3.so
#29 0x00007fffeb0f143a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6
#30 0x00007ffff6941d3c in QWidgetPrivate::sendPaintEvent(QRegion const&) () at /usr/lib/libQt6Widgets.so.6
#31 0x00007ffff6943b1c in QWidgetPrivate::drawWidget(QPaintDevice*, QRegion const&, QPoint const&, QFlags<QWidgetPrivate::DrawWidgetFlag>, QPainter*, QWidgetRepaintManager*) () at /usr/lib/libQt6Widgets.so.6
#32 0x00007ffff695ffc4 in  () at /usr/lib/libQt6Widgets.so.6
#33 0x00007ffff6952106 in QWidget::event(QEvent*) () at /usr/lib/libQt6Widgets.so.6
#34 0x00007fffd76bc95c in  () at /usr/lib/python3.10/site-packages/PyQt6/QtWidgets.abi3.so
#35 0x00007ffff690db5d in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6
#36 0x00007fffd7691c57 in  () at /usr/lib/python3.10/site-packages/PyQt6/QtWidgets.abi3.so
#37 0x00007fffeb0f143a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6
#38 0x00007fffeb0f1608 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/libQt6Core.so.6
#39 0x00007ffff6c94d28 in  () at /usr/lib/libQt6Widgets.so.6
#40 0x00007fffeb13774b in QObject::event(QEvent*) () at /usr/lib/libQt6Core.so.6
#41 0x00007fffd75c9a9c in  () at /usr/lib/python3.10/site-packages/PyQt6/QtWidgets.abi3.so
#42 0x00007ffff690db5d in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6
#43 0x00007fffd7691c57 in  () at /usr/lib/python3.10/site-packages/PyQt6/QtWidgets.abi3.so
#44 0x00007fffeb0f143a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt6Core.so.6
#45 0x00007fffeb0f1608 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/libQt6Core.so.6
#46 0x00007fffeb30c768 in  () at /usr/lib/libQt6Core.so.6
#47 0x00007fffe7e87163 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#48 0x00007fffe7edd9e9 in  () at /usr/lib/libglib-2.0.so.0
#49 0x00007fffe7e846c5 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#50 0x00007fffeb30a8d0 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6
#51 0x00007fffeb0f994b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Core.so.6
#52 0x00007fffeb0f3fb9 in QCoreApplication::exec() () at /usr/lib/libQt6Core.so.6
#53 0x00007fffd768d47e in  () at /usr/lib/python3.10/site-packages/PyQt6/QtWidgets.abi3.so
#54 0x00007ffff7d2d488 in  () at /usr/lib/libpython3.10.so.1.0
#55 0x00007ffff7d26ddb in _PyObject_MakeTpCall () at /usr/lib/libpython3.10.so.1.0
#56 0x00007ffff7d221c5 in _PyEval_EvalFrameDefault () at /usr/lib/libpython3.10.so.1.0
#57 0x00007ffff7d1b752 in  () at /usr/lib/libpython3.10.so.1.0
#58 0x00007ffff7dd2f64 in PyEval_EvalCode () at /usr/lib/libpython3.10.so.1.0
#59 0x00007ffff7de2df4 in  () at /usr/lib/libpython3.10.so.1.0
#60 0x00007ffff7dde7bb in  () at /usr/lib/libpython3.10.so.1.0
#61 0x00007ffff7c7ac13 in  () at /usr/lib/libpython3.10.so.1.0
#62 0x00007ffff7c7a893 in _PyRun_SimpleFileObject () at /usr/lib/libpython3.10.so.1.0
#63 0x00007ffff7c7b228 in _PyRun_AnyFileObject () at /usr/lib/libpython3.10.so.1.0
#64 0x00007ffff7def6ab in Py_RunMain () at /usr/lib/libpython3.10.so.1.0
#65 0x00007ffff7dc398d in Py_BytesMain () at /usr/lib/libpython3.10.so.1.0
#66 0x00007ffff7a00310 in __libc_start_call_main () at /usr/lib/libc.so.6
#67 0x00007ffff7a003c1 in __libc_start_main_impl () at /usr/lib/libc.so.6
#68 0x0000555555555045 in _start ()

Process *eaf* finished

wrongly render single-page pdf

  • If EAF was working correctly until a recent git pull, please refer to Mandatory Procedures to Keep Your EAF Up-to-Date first.
  • Please check the *eaf* buffer, if there is any error shown in the *eaf* buffer, paste it here.
    There are no errors in *eaf* buffer.

Describe the bug
When I use eaf-pdf-viewer to open a single-page pdf generated by LaTex, it is wrongly rendered as shown in the following screenshot.
The pdf is rendered by wps pdf without any errors.

To Reproduce
Just open a single-page pdf generated by LaTex.

Expected behavior
Many pages are shown.

Versions (please complete the following info):

  • Distro and DE/WM: Manjaro i3

  • Versions of Dependencies:

  • M-x emacs-version: GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6) of 2022-09-12

Screenshots
flameshotpWWYN5

Additional context
This is the single-page pdf shown in the above screenshot.
tikz_scratch.pdf

请问选择文本的快捷键是什么?

使用eaf-pdf-viewer是为了追求全键盘,README中介绍了复制文本是 M-w,但是选择文本我还是只能用鼠标去选择。
请问是否能纯键盘去选择文本?
非常感谢您的插件!

提示“Failed to reload PDF file!”

eaf-pdf-viewer最近总是提示“Failed to reload PDF file!”,定位到eaf_pdf_document.py的100行,去掉try .. catch之后*eaf* buffer里面显示

RuntimeError: wrapped C/C++ object of type PdfViewerWidget has been deleted

  • Distro and DE/WM: Manjaro and i3wm
  • Versions of Dependencies:
  • M-x emacs-version: GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6) of 2022-09-12

加速渲染

启动的时候,自动用后台线程抓取PDF文件所有图像,避免用户按键太快以后卡页面。

Using with Auctex

Describe alternatives you've considered
I have configured it with Auctex, and it is working as expected. I come from a pdf-tools background, it works much better than pdf-tools in fact I love to use dark mode to view the pdf. The only thing that bothers me is the accuracy of "Double click the left button to edit backward" which is only showing the line but not the word, but in pdf-tools, it was accurate up to words in most cases. In fact, auctex supports this accuracy. It would be great if EAF could be configured to word-level accuracy for reverse searching.

Additional context
My auctex setup is as follows
`(load "auctex.el" nil t t); it loads auctex

(add-hook 'LaTeX-mode-hook ;this are the hooks I want to enable during LaTeX-mode
(lambda()
(turn-on-reftex) ;enable reftex
(set (make-local-variable 'company-backends) '((separate: company-reftex-labels company-reftex-citations) (separate: company-auctex-symbols company-auctex-environments company-capf company-auctex-macros) company-math-symbols-latex
company-latex-commands ))
(rainbow-delimiters-mode)
(setq TeX-auto-save t) ;enable autosave on during LaTeX-mode
(setq TeX-parse-self t) ; enable autoparsing
(setq TeX-save-query nil) ;
(setq TeX-source-correlate-method 'synctex) ; enable synctex
(setq TeX-source-correlate-mode t) ; enable text-source-correlate using synctex
(add-to-list 'TeX-view-program-list '("eaf" eaf-pdf-synctex-forward-view ))
(add-to-list 'TeX-view-program-selection '(output-pdf "eaf"))
(setq predictive-latex-electric-environments 1)
(TeX-fold-mode 1); enabling tex fold mode for better readability.
(setq-default TeX-master nil)
(global-set-key (kbd "C-c C-g") 'pdf-sync-forward-search) ;sync from text to pdf
(add-hook 'TeX-after-compilation-finished-functions
#'TeX-revert-document-buffer) ; reload pdf buffer
(setq reftex-plug-into-AUCTeX t) ; enable auctex
(setq reftex-bibliography-commands '("bibliography" "nobibliography" "addbibresource"))
(local-set-key [C-tab] 'TeX-complete-symbol) ;tex complete symbol
; could be ispell as well, depending on your preferences
(setq ispell-program-name "aspell")
; this can obviously be set to any language your spell-checking program supports
(setq ispell-dictionary "english")
(flyspell-mode) ; flyspell mode enable
(flyspell-buffer); flyspell buffer
(turn-on-auto-fill)
(visual-line-mode)
(LaTeX-math-mode)
)
)
`

The PDF viewer doesn't seem to be able to handle mouse events at high speed

Describe the bug
The visual response lags a bit when I try to select parts of the text

To Reproduce
Repeated selection of parts of the text (if you combine scrolling with selection, this problem becomes more apparent).

Expected behavior
The visual response becomes more smoothly, just like in the Okular.

Versions (please complete the following info):

  • Distro and DE/WM: Arch / KDE
  • Versions of Dependencies:
    • PyQt5 5.15.4
    • PyQtWebEngine 5.15.4
    • PyMuPDF 1.18.17
  • M-x emacs-version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.29, cairo version 1.17.4)

Screenshots
NA

eaf-pdf-dark-mode do not display correct.

I use modus-themes, with white background for sunrise, and blackground for sunset.

Config related eaf-pdf-viewer:

(setq eaf-pdf-dark-mode "follow")

If current background is white, When I open a pdf file, the color do not display correct, I need to press key i to toggle inverted mode.
Screenshot from 2022-03-08 15-02-41

If I change theme to black background, `modus-themes-toggle', re-open the pdf file, the display was right.

If I set eaf-pdf-dark-mode to force' , the display behavior same as follow'.

Make pdf-viewer have custom dark background like pdf-tools?

Hi,

Is your feature request related to a problem? Please describe.

Currently, EAF pdf-viewer can support only the original background color (often white) or inverted background color (white -> black) of a document.

I cannot set a custom background color (In pdf-tools, I can do so by setting the background color in mid-night mode)

Describe the solution you'd like

It would be nice if EAF pdf-viewer can support the custom background color of documents (so that this background color can match with the background theme of Emacs)

Describe alternatives you've considered

I looked into this code of buffer.py and see that the inverted color is controlled at the pixel level by the function call pixmap.invertIRect(pixmap.irect) to PyMuPDF.

    def with_invert(self, invert, exclude_image=True):
        ...
        def fn(page, pixmap, scale):
            pixmap.invertIRect(pixmap.irect)

I haven't figured out how to make PyMuPDF only render text in inverted mode and set the background according to users' preferences.

Is this possible to implement such a feature in EAF pdf-viewer?

Crash with large PDF and Chinese chars after the second compilation with auctex

Describe the bug

使用 auctex 编译文件, eaf-pdf-viewer 预览。
当文件中包含大量中文且页码很多时,第一次编译顺利通过且预览顺利。
但是稍作修改后第二次编译,PDF 文件顺利生成,但 eaf-pdf-viewer buffer 就显示空白。

*eaf* 中的信息如下 (前两行是打开的时候就有的)

QApplication: invalid style override 'kvantum' passed, ignoring it.
	Available styles: Windows, Fusion
Failed to watch callback
Traceback (most recent call last):
  File "/home/allenryb/.emacs.d/site-lisp/emacs-application-framework/app/pdf-viewer/eaf_pdf_widget.py", line 374, in paintEvent
    qpixmap = self.get_page_pixmap(index, self.scale * hidpi_scale_factor, self.rotation)
  File "/home/allenryb/.emacs.d/site-lisp/emacs-application-framework/app/pdf-viewer/eaf_pdf_widget.py", line 295, in get_page_pixmap
    page = self.document[index]
  File "/home/allenryb/.emacs.d/site-lisp/emacs-application-framework/app/pdf-viewer/eaf_pdf_document.py", line 59, in __getitem__
    page = PdfPage(self.document[index], index, self.document.isPDF)
  File "/home/allenryb/.local/lib/python3.10/site-packages/fitz/fitz.py", line 5571, in __getitem__
    raise IndexError("page not in document")
IndexError: page not in document

Process *eaf* aborted (core dumped)

To Reproduce

我使用以下 TeX 代码测试。zhlipsum是用来生成中文字段的,生成的 PDF 总计 78 页。
TeX 文件中有 4 个 section,如果删除 1 个 section,那就不会出现上面的问题。
如果文件中是全英文,那也不会出现上面的问题。

\documentclass{article}
\usepackage{zhlipsum}
\usepackage[fontset=none,UTF8]{ctex}
\setCJKmainfont{Sarasa UI SC}

\begin{document}

\section{S1}

\zhlipsum[-]

If we want dummy text in our document then we generally search for lorem ipsum text generators and copy-paste those texts/paragraphs in our document.

\section{S2}

\zhlipsum[-]

If we want dummy text in our document then we generally search for lorem ipsum text generators and copy-paste those texts/paragraphs in our document.

\section{S3}

\zhlipsum[-]

If we want dummy text in our document then we generally search for lorem ipsum text generators and copy-paste those texts/paragraphs in our document.

\section{S4}

\zhlipsum[-]

If we want dummy text in our document then we generally search for lorem ipsum text generators and copy-paste those texts/paragraphs in our document.

\end{document}

%%% Local Variables: 
%%% coding: utf-8
%%% mode: latex
%%% TeX-engine: xetex
%%% End: 

Expected behavior
希望能正常运行。

Versions (please complete the following info):
我用的系统是 archlinux,emace-version 是 28.1

Exception: Unrecognised args for constructing Pixmap

Describe the bug
EAF-pdf-viewer显示白板,查看eaf buffer后显示如下信息:

QApplication: invalid style override 'kvantum' passed, ignoring it.
Available styles: Windows, Fusion
Traceback (most recent call last):
File "/home/elon/emacs-application-framework/app/pdf-viewer/eaf_pdf_widget.py", line 499, in paintEvent
self.draw_scroll_pages(painter)
File "/home/elon/emacs-application-framework/app/pdf-viewer/eaf_pdf_widget.py", line 559, in draw_scroll_pages
(_, _, page_render_height) = self.get_page_render_info(self.start_page_index)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/elon/emacs-application-framework/app/pdf-viewer/eaf_pdf_widget.py", line 411, in get_page_render_info
qpixmap = self.get_page_pixmap(index, self.scale * hidpi_scale_factor, self.rotation)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/elon/emacs-application-framework/app/pdf-viewer/eaf_pdf_widget.py", line 396, in get_page_pixmap
qpixmap = page.get_qpixmap(scale, self.get_inverted_mode(), self.inverted_image_mode)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/elon/emacs-application-framework/app/pdf-viewer/eaf_pdf_page.py", line 195, in get_qpixmap
pixmap = self.make_background_transparent(pixmap, (255,255,255))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/elon/emacs-application-framework/app/pdf-viewer/eaf_pdf_page.py", line 260, in make_background_transparent
pixalpha = fitz.Pixmap(None, pixmap)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/elon/.local/lib/python3.11/site-packages/fitz/init.py", line 9690, in init
raise Exception( text)
Exception: Unrecognised args for constructing Pixmap:
<class 'NoneType'>: None
<class 'fitz.Pixmap'>: Pixmap(DeviceRGB, (0, 0, 656, 928), 1)

Process eaf aborted (core dumped)

查询资料后发现是pymupdf依赖没有安装好,于是使用pip命令加--break-system-packages强制卸载pymupdf和fitz,然后按照同样强制pip重装fitz和pymupdf,安装顺序为先fitz然后再安装pymupdf,但是问题依然没有得到解决。

我使用arco linux,emacs为29,python版本为3.11

Screenshot_20240129_121056
Screenshot_20240129_121111

Certain PDFs failing to open with error "ValueError: rect not in mediabox"

Describe the bug
I drag and drop a PDF such as this one (I can provide other examples which fail in the same way) into the emacs buffer:

mwb_E_202201.pdf

The buffer goes blank. I do not have this issue with other PDFs, such as this one:

https://arxiv.org/abs/2002.01247

Previously both of these PDFs successfully loaded in eaf-pdf-viewer. However, in the process of trying out the latest pymupdf wheel (related to #62) these certain PDFs like the first one no longer load (but other PDFs like the second one work as expected). The eaf buffer shows the following error when I drag and drop the first PDF:

Traceback (most recent call last):
  File "/home/mymailuser/emacs/emacs-application-framework/app/pdf-viewer/buffer.py", line 1158, in paintEvent
    qpixmap = self.get_page_pixmap(index, self.scale * hidpi_scale_factor, self.rotation)
  File "/home/mymailuser/emacs/emacs-application-framework/app/pdf-viewer/buffer.py", line 1079, in get_page_pixmap
    page = self.document[index]
  File "/home/mymailuser/emacs/emacs-application-framework/app/pdf-viewer/buffer.py", line 475, in __getitem__
    page = PdfPage(self.document[index], index, self.document.isPDF)
  File "/home/mymailuser/emacs/emacs-application-framework/app/pdf-viewer/buffer.py", line 584, in __init__
    self._page_rawdict = self._init_page_rawdict()
  File "/home/mymailuser/emacs/emacs-application-framework/app/pdf-viewer/buffer.py", line 599, in _init_page_rawdict
    set_page_crop_box(self.page)(self.clip)
  File "/home/mymailuser/.local/lib/python3.7/site-packages/fitz/fitz.py", line 6525, in set_cropbox
    return self._set_pagebox("CropBox", rect)
  File "/home/mymailuser/.local/lib/python3.7/site-packages/fitz/fitz.py", line 6520, in _set_pagebox
    raise ValueError("rect not in mediabox")
ValueError: rect not in mediabox

To Reproduce

  1. Download the first PDF I included above.
  2. Open emacs.
  3. Drag and drop the PDF into the emacs buffer.

Expected behavior
The eaf-pdf-viewer successfully opens the PDF for reading.

Versions (please complete the following info):

  • Distro and DE/WM: Turnkey Linux 16 and Xfce4
  • Versions of Dependencies:
    -- python3-pyqt5 5.11.3+dfsg-1+b3
    -- python3-dbus 1.2.8-3
    -- python3-pyqt5.qtwebengine 5.11.3+dfsg-1+b3
  • M-x emacs-version: GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0) of 2022-02-22

Screenshots
Here is a screenshot showing what I see after dragging and dropping the PDF:
image

Additional context
Add any other context about the problem here.

`clean_unused_page_cache_pixmap` doesn't work as intended.

image

Open a lengthy PDF (hundreds of pages) and hold space bar ⇒ Memory usage will be increasing until a maximum value (all pages rendered and hold in memory). After rendering a few hundreds of pages, eaf-pdf-viewer will consume > 1 GiB memory.

I thought there is no handling of old pages that users cannot see, and it turns out to be one.

However, it doesn't seem to work?

It is called here:

# Clean unused pixmap cache that avoid use too much memory.
self.clean_unused_page_cache_pixmap()

And the code only pop the oldest one.

def clean_unused_page_cache_pixmap(self):
# We need expand render index bound that avoid clean cache around current index.
index_list = list(range(self.start_page_index, self.last_page_index))
# Try to clean unused cache.
cache_index_list = list(self.page_cache_pixmap_dict.keys())
for cache_index in cache_index_list:
if cache_index not in index_list:
self.page_cache_pixmap_dict.pop(cache_index)

Following links in PDFs and epubs

Is your feature request related to a problem? Please describe.
I've found that PDFs and epubs which contain links can't have the links followed when clicked in eaf-pdf-viewer. As examples, here are two documents which have this behavior for me:

PDF: https://arxiv.org/abs/2002.01247
This document has various links which can be clicked to navigate to parts of the PDF, like references at the end.

epub: https://creativecommons.org/use-remix/made-with-cc/
This document has various links which can be clicked on to navigate to things like endnotes in the epub chapters.

I see there are keyboard shortcuts m and f related to links, but they don't seem to do be following links or enable clicking of links.

Describe the solution you'd like
Simply allow for a link to be clicked and followed.

Describe alternatives you've considered
None.

Additional context
Screenshot of the above PDF in eaf-pdf-viewer which has links:
image

Screenshot of the above epub in eaf-pdf-viewer which has links:
image

Cannot execute function: edit_annot_text

  • Please check the *eaf* buffer, if there is any error shown in the *eaf* buffer, paste it here.
qt5ct: using qt5ct plugin
Traceback (most recent call last):
  File "/home/yongfeizhai/.emacs.d/extensions/emacs-application-framework/eaf.py", line 365, in eval_function
    getattr(buffer, function_name)()
  File "/home/yongfeizhai/.emacs.d/extensions/emacs-application-framework/app/pdf-viewer/buffer.py", line 303, in edit_annot_text
    self.buffer_widget.annot_handler("edit")
  File "/home/yongfeizhai/.emacs.d/extensions/emacs-application-framework/app/pdf-viewer/buffer.py", line 1884, in annot_handler
    self.edited_annot_page = (annot, annot.parent.page)
AttributeError: 'Page' object has no attribute 'page'

Describe the bug
When mouse hover on an annotation, and press M-e will cause this problem

Versions :

  • eaf and eaf-pdf-viewer is the latest version
  • DE: GNOME 3.36.5
  • pymupdf 1.19.6
  • GNU Emacs 28.0.91 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-03-09

Screenshots
image

image

Keep focus in TeX file after TeX-view

I am using eaf-pdf-viewer and auctex.

After TeX-view (C-c C-v), the focus switches from tex buffer to PDF buffer.
Is it possible to keep focus on the tex buffer?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.