Rectangle class
Leave feedback
On this page
Describes a rectangular area on a page or image, for example an OCR text bounds or a redaction box.
The Rectangle type exposes the following members:
| Constructor | Description |
|---|---|
| init | Initializes a rectangle from corner coordinates and dimensions. |
| init | Initializes a rectangle from a top-left point and region size. |
| Method | Description |
|---|---|
| equals | Compares the bounds with another rectangle. |
| equals | Compares this rectangle with another object. |
| get_hash_code | Returns a hash code derived from position and size. |
| to_string | Returns the bounds in a readable form. |
| Property | Description |
|---|---|
| height | The height of the area, in pixels. |
| is_empty | The rectangle is empty. |
| location | The top-left corner of the rectangle. |
| size | The width and height of the rectangle. |
| width | The width of the area, in pixels. |
| x | The horizontal position of the top-left corner, in pixels. |
| y | The vertical position of the top-left corner, in pixels. |
| Field | Description |
|---|---|
| EMPTY | A rectangle with zero width and height at the origin. |
from groupdocs.redaction.options.drawing import Rectangle
# Define a rectangle at position (40, 40) with size 120x40
rect = Rectangle(40, 40, 120, 40)
print(rect)
Task guides that use Rectangle:
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.