Skip to content

AttributeError: 'Rect' object has no attribute 'get_area' #360

@HaoSun1

Description

@HaoSun1

Description of the bug

AttributeError: 'Rect' object has no attribute 'get_area'

ltow.py
FVShard.pdf

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
cv.convert(docx_file)
File "C:\Users\hao_s\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2docx\converter.py", line 349, in convert
self.parse(start, end, pages, **settings).make_docx(docx_filename, **settings)
File "C:\Users\hao_s\AppData\Local\Programs\Python\Python39\lib\site-packages\pdf2docx\converter.py", line 128, in parse
return self.load_pages(start, end, pages)
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions