-
Notifications
You must be signed in to change notification settings - Fork 24
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
Certain PDFs failing to open with error "ValueError: rect not in mediabox" #63
Comments
@luhuaei Can you help fix this ? |
👌 I assign myself. |
@Jdogzz That is to say you install pre-version pymupdf(1.19.6 wheel) cause above error, but previously pymupdf can successfully loaded both PDFs? But I use
Maybe it's not a version issue. |
Thanks for taking a look at this. That's correct, both PDFs worked in a previous version, and sadly I no longer know which version I had installed before. With some testing I've been able to include more information. For posterity, repeating your python output I get this for fitz on my end after having installed the preview wheel:
I am able to reproduce the error I originally reported with the first PDF in a clean test environment, an Ubuntu 21.10 VM, with a freshly compiled copy of emacs from git and following the bare bones setup from the eaf README. This has occurred with the stable version of pymupdf. Here's the relevant info: python3-pyqt5 5.15.4+dfsg-3 GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.30, cairo version 1.16.0) of 2022-02-23
Here is the debug log from the
As before, the first PDF does not render in the emacs buffer. |
As a small update, with some further testing I have found there was a regression in going from pymupdf 1.19.3 and 1.19.4. When using pymupdf 1.19.3 I am able to successfully open the first PDF in eaf-pdf-viewer, and when using pymupdf 1.19.4 and later versions I get the above error. |
With some more testing I was able to pinpoint the bug as an apparent mismatch of cropbox and mediabox used by pymupdf, I have opened a bug report here: pymupdf/PyMuPDF#1615 |
The PyMuPDF author corrected my understanding of the issue, that it was related to handling non-integer sizes of the boxes, and solved that half of the problem in pymupdf/PyMuPDF#1616 The other half seems to be related to an unnecessary transformation which I believe I have addressed in #65. |
Thanks! |
On my testing, This problem already fixed. I close this issue. |
git pull
, please refer to Mandatory Procedures to Keep Your EAF Up-to-Date first.*eaf*
buffer, if there is any error shown in the*eaf*
buffer, paste it here.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:
To Reproduce
Expected behavior
The eaf-pdf-viewer successfully opens the PDF for reading.
Versions (please complete the following info):
-- python3-pyqt5 5.11.3+dfsg-1+b3
-- python3-dbus 1.2.8-3
-- python3-pyqt5.qtwebengine 5.11.3+dfsg-1+b3
Screenshots
![image](https://user-images.githubusercontent.com/2792697/155260540-2e256ffa-d1d3-428b-ac8d-d1aef91701e1.png)
Here is a screenshot showing what I see after dragging and dropping the PDF:
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: