Comments (9)
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.
from eaf-pdf-viewer.
@luhuaei Can you help fix this ?
from eaf-pdf-viewer.
@luhuaei Can you help fix this ?
👌 I assign myself.
from eaf-pdf-viewer.
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)
@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 pymupdf-1.19.4
open the mwb_E_202201.pdf
can reproduce above problem.
>>> import fitz
>>> fitz.__doc__
'\nPyMuPDF 1.19.4: Python bindings for the MuPDF 1.19.0 library.\nVersion date: 2022-01-01 00:00:01.\nBuilt for Python 3.9 on linux (64-bit).\n'
>>>
Maybe it's not a version issue.
from eaf-pdf-viewer.
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:
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fitz
>>> fitz.__doc__
'\nPyMuPDF 1.19.6: Python bindings for the MuPDF 1.19.0 library.\nVersion date: 2022-03-01 00:00:01.\nBuilt for Python 3.7 on linux (64-bit).\n'
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
python3-dbus 1.2.16-5
python3-pyqt5.qtwebengine 5.15.4-1
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
Python 3.9.7 (default, Sep 10 2021, 14:59:43)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import fitz
>>> fitz.__doc__
'\nPyMuPDF 1.19.5: Python bindings for the MuPDF 1.19.0 library.\nVersion date: 2022-02-01 00:00:01.\nBuilt for Python 3.9 on linux (64-bit).\n'
Here is the debug log from the *eaf*
buffer when I attempted to load the first PDF:
Traceback (most recent call last):
File "/home/etest/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/etest/emacs-application-framework/app/pdf-viewer/buffer.py", line 1079, in get_page_pixmap
page = self.document[index]
File "/home/etest/emacs-application-framework/app/pdf-viewer/buffer.py", line 475, in __getitem__
page = PdfPage(self.document[index], index, self.document.isPDF)
File "/home/etest/emacs-application-framework/app/pdf-viewer/buffer.py", line 584, in __init__
self._page_rawdict = self._init_page_rawdict()
File "/home/etest/emacs-application-framework/app/pdf-viewer/buffer.py", line 599, in _init_page_rawdict
set_page_crop_box(self.page)(self.clip)
File "/home/etest/.local/lib/python3.9/site-packages/fitz/fitz.py", line 6414, in set_cropbox
return self._set_pagebox("CropBox", rect)
File "/home/etest/.local/lib/python3.9/site-packages/fitz/fitz.py", line 6409, in _set_pagebox
raise ValueError("rect not in mediabox")
ValueError: rect not in mediabox
QBackingStore::endPaint() called with active painter; did you forget to destroy it or call QPainter::end() on it?
QPainter::end: Painter ended with 2 saved states
Traceback (most recent call last):
File "/home/etest/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/etest/emacs-application-framework/app/pdf-viewer/buffer.py", line 1079, in get_page_pixmap
page = self.document[index]
File "/home/etest/emacs-application-framework/app/pdf-viewer/buffer.py", line 475, in __getitem__
page = PdfPage(self.document[index], index, self.document.isPDF)
File "/home/etest/emacs-application-framework/app/pdf-viewer/buffer.py", line 584, in __init__
self._page_rawdict = self._init_page_rawdict()
File "/home/etest/emacs-application-framework/app/pdf-viewer/buffer.py", line 599, in _init_page_rawdict
set_page_crop_box(self.page)(self.clip)
File "/home/etest/.local/lib/python3.9/site-packages/fitz/fitz.py", line 6414, in set_cropbox
return self._set_pagebox("CropBox", rect)
File "/home/etest/.local/lib/python3.9/site-packages/fitz/fitz.py", line 6409, in _set_pagebox
raise ValueError("rect not in mediabox")
ValueError: rect not in mediabox
QBackingStore::endPaint() called with active painter; did you forget to destroy it or call QPainter::end() on it?
QPainter::end: Painter ended with 2 saved states
Traceback (most recent call last):
File "/home/etest/emacs-application-framework/app/pdf-viewer/buffer.py", line 2031, in eventFilter
self.check_annot()
File "/home/etest/emacs-application-framework/app/pdf-viewer/buffer.py", line 1856, in check_annot
page = self.document[page_index]
File "/home/etest/emacs-application-framework/app/pdf-viewer/buffer.py", line 475, in __getitem__
page = PdfPage(self.document[index], index, self.document.isPDF)
File "/home/etest/emacs-application-framework/app/pdf-viewer/buffer.py", line 584, in __init__
self._page_rawdict = self._init_page_rawdict()
File "/home/etest/emacs-application-framework/app/pdf-viewer/buffer.py", line 599, in _init_page_rawdict
set_page_crop_box(self.page)(self.clip)
File "/home/etest/.local/lib/python3.9/site-packages/fitz/fitz.py", line 6414, in set_cropbox
return self._set_pagebox("CropBox", rect)
File "/home/etest/.local/lib/python3.9/site-packages/fitz/fitz.py", line 6409, in _set_pagebox
raise ValueError("rect not in mediabox")
ValueError: rect not in mediabox
Saved session: /home/etest/emacs-application-framework/app/pdf-viewer/buffer.py /home/etest/Downloads/mwb_E_202201.pdf 2087.6365062761474:1.4781746031746033:fit_to_width:True:0
As before, the first PDF does not render in the emacs buffer.
from eaf-pdf-viewer.
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.
from eaf-pdf-viewer.
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
from eaf-pdf-viewer.
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!
from eaf-pdf-viewer.
On my testing, This problem already fixed. I close this issue.
from eaf-pdf-viewer.
Related Issues (20)
- Page scrolling bug in single-page display mode HOT 1
- Consider supporting occur searches HOT 6
- 分屏后不能立刻适应页面宽度 HOT 1
- 选中区域后区域里的内容消失 HOT 18
- Exception: Unrecognised args for constructing Pixmap HOT 3
- Crash with large PDF and Chinese chars after the second compilation with auctex HOT 7
- `clean_unused_page_cache_pixmap` doesn't work as intended. HOT 5
- getToC rename to get_toc in pymupdf-1.20.1 HOT 1
- pdf添加标注报错 HOT 4
- Error pdf trought ssh HOT 5
- eaf-pdf-viewer cannot open PDF compiled from LaTex when changes are made HOT 2
- fitz module installed similar package (not from mupdf) HOT 4
- Using with Auctex HOT 2
- 如果要把本项目改造成一个独立的PDF阅读器,请问该从哪里改起? HOT 1
- wrongly render single-page pdf
- EAF Inverting PDF to black and white despite saying "follow" system theme. HOT 1
- When in presentation mode, scroll_*_page doesn't work HOT 1
- 页面跳转不准确 HOT 6
- 提示“Failed to reload PDF file!” HOT 4
- 请问选择文本的快捷键是什么? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eaf-pdf-viewer.