Skip to content

'Rect' object has no attribute 'get_area' #4742

@fareshan

Description

@fareshan

Description of the bug

get_area became not working

I get this error: AttributeError: 'Rect' object has no attribute 'get_area'

How to reproduce the bug

Open Google Colab and put this script:

%pip install pymupdf
import fitz  # PyMuPDF

# Create a dummy PDF document
doc = fitz.open()
page = doc.new_page()

# Test the get_area() function
area_in_inches = page.rect.get_area("in")

print(f"Area of the page in square inches: {area_in_inches}")

=> Error:

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

Documentation:
https://pymupdf.readthedocs.io/en/latest/rect.html#Rect.get_area

The problem exists even in older versions of pymupdf.
I was not getting the problem with the same code before. I don't know what has changed recently so that get_area became not usable

PyMuPDF version

1.26.5

Operating system

MacOS

Python version

3.11

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions