Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't open pdf #1137

Closed
jenenliu opened this issue Feb 1, 2024 · 7 comments
Closed

Can't open pdf #1137

jenenliu opened this issue Feb 1, 2024 · 7 comments

Comments

@jenenliu
Copy link

jenenliu commented Feb 1, 2024

Describe the bug
Cant Open a pdf file

To Reproduce
eaf-open, select a pdf file, nothing happend

Expected behavior
open pdf

Versions (please complete the following info):

  • Distro and DE/WM:
    Arch Linux, Gnome
  • Versions of Dependencies:
  • M-x emacs-version:
    GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) of 2024-02-01

Error logs
Please check the *eaf* buffer, if there is any error in it, paste it here.

Traceback (most recent call last):
  File "/usr/share/emacs/lazycat/extensions/emacs-application-framework/app/pdf-viewer/eaf_pdf_widget.py", line 499, in paintEvent
    self.draw_scroll_pages(painter)
  File "/usr/share/emacs/lazycat/extensions/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 "/usr/share/emacs/lazycat/extensions/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 "/usr/share/emacs/lazycat/extensions/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 "/usr/share/emacs/lazycat/extensions/emacs-application-framework/app/pdf-viewer/eaf_pdf_page.py", line 193, in get_qpixmap
    pixmap = self.make_background_transparent(pixmap, sample_color[:3])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/emacs/lazycat/extensions/emacs-application-framework/app/pdf-viewer/eaf_pdf_page.py", line 260, in make_background_transparent
    pixalpha = fitz.Pixmap(None, pixmap)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jenenliu/.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, 2560, 3170), 1)

Process *eaf* aborted (core dumped)
doh set to ""  --  SystemOnly
[EAF] Browser https://github.com/emacs-eaf/emacs-application-framework loading time: 5.172097206115723s
[EAF] Browser https://github.com/emacs-eaf/emacs-application-framework/issues/new/choose loading time: 1.6242930889129639s
[EAF] Browser https://github.com/emacs-eaf/emacs-application-framework/issues/new?assignees=&labels=&projects=&template=bug_report.md&title= loading time: 0.9911534786224365s

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

Additional context
Add any other context about the problem here.

@damoncro
Copy link

damoncro commented Feb 1, 2024

Same error.

@damoncro
Copy link

damoncro commented Feb 1, 2024

Downgraded pymupdf as workaround:
pip3 install pymupdf==1.23.8

@manateelazycat
Copy link
Member

@luhuaei Can you help to fix this?

@manateelazycat
Copy link
Member

I have install pymupdf 1.23.9, can't reproduce this issue.

@longminwang
Copy link
Contributor

Another workaround is to replace import fitz by import fitz_old as fitz.

Please see
New 'rebased' implementation of PyMuPDF
PyMuPDF-1.23.9 released
for details.

@luhuaei
Copy link
Contributor

luhuaei commented Feb 18, 2024

I can reproduce the problem, I use pacman -S python-pymupdf

>>> import fitz 
>>> fitz.version
('1.23.22', '1.23.10', '20240212000001')

pymupdf/PyMuPDF#3177
pymupdf/PyMuPDF#3182

@luhuaei
Copy link
Contributor

luhuaei commented Feb 21, 2024

Fixed in pymupdf 1.23.25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants