AttributeError: 'Rect' object has no attribute 'get_area'
Description of the bug
AttributeError: 'Rect' object has no attribute 'get_area'
How to reproduce the bug
Run the following code
C:\Users\hao_s\Downloads>py ltow.py
[INFO] Start to convert C:\Users\hao_s\Downloads\FVShard.pdf
[INFO] ←[1;36m[1/4] Opening document...←[0m
[INFO] ←[1;36m[2/4] Analyzing document...←[0m
Traceback (most recent call last):
File "C:\Users\hao_s\Downloads\ltow.py", line 7, in
File "C:\Users\hao_s\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2docx\converter.py", line 169, in parse_document
self._pages.parse(self.fitz_doc, **kwargs)
File "C:\Users\hao_s\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2docx\page\Pages.py", line 37, in parse
raw_page.restore(**settings)
File "C:\Users\hao_s\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2docx\common\share.py", line 240, in inner
objects = func(*args, **kwargs)
File "C:\Users\hao_s\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2docx\page\RawPage.py", line 67, in restore
raw_dict = self.extract_raw_dict(**settings)
File "C:\Users\hao_s\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2docx\page\RawPageFitz.py", line 36, in extract_raw_dict
shapes, images = self._preprocess_shapes(**settings)
File "C:\Users\hao_s\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2docx\page\RawPageFitz.py", line 123, in _preprocess_shapes
paths = self._init_paths(**settings)
File "C:\Users\hao_s\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2docx\common\share.py", line 240, in inner
objects = func(*args, **kwargs)
File "C:\Users\hao_s\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2docx\page\RawPageFitz.py", line 136, in _init_paths
return Paths(parent=self).restore(raw_paths)
File "C:\Users\hao_s\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2docx\shape\Paths.py", line 27, in restore
path = Path(raw)
File "C:\Users\hao_s\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2docx\shape\Path.py", line 258, in init
if rect.get_area()==0: rect += (-w, -w, w, w)
C:\Users\hao_s\Downloads>
### pdf2docx version
0.5.8
### Operating system
Windows
### Python version
3.9
I have the same problem.
It seems an issue of pymupdf: https://github.com/pymupdf/pymupdf/issues/4742
pip install pymupdf==1.26.4 resolved this issue for me.
I have the same problem. To avoid installing it in a project that does not require this package, could you update it in the next version of pdf2docx? Thank you in advance!