---
Product: Aspose.PDF
Platform: net
Page Type: reference
Canonical URL: https://reference.aspose.org/pdf/net/Rectangle-Pdf
---

# Rectangle

## Overview

`Rectangle` is a class in Aspose.PDF FOSS for .NET.

Represents a rectangle defined by lower-left and upper-right coordinates (PDF user-space convention: Y increases upward).

This class provides 25 methods for working with Rectangle objects in .NET programs.
Available methods include: `Center`, `Clone`, `Contains`, `ContainsLine`, `ContainsPoint`, `Equals`, `FromRect`, `GetHashCode`, `Intersect`, `IsIntersect`, `Join`, `MoveBy`, and 7 additional methods.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: `Empty`, `Height`, `IsEmpty`, `IsPoint`, `IsTrivial`, `LLX`, and 5 more.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `LLX` | `double` | Read/Write | Gets or sets the llx. |
| `LLY` | `double` | Read/Write | Gets or sets the lly. |
| `URX` | `double` | Read/Write | Gets or sets the urx. |
| `URY` | `double` | Read/Write | Gets or sets the ury. |
| `Width` | `double` | Read | Gets the width. |
| `Height` | `double` | Read | Gets the height. |
| `Empty` | `Rectangle` | Read | An empty rectangle (all coordinates zero). |
| `Trivial` | `Rectangle` | Read | The trivial / sentinel rectangle (-1, -1, -1, -1) used by Aspose.PDF as a "no value" marker. |
| `IsPoint` | `bool` | Read | True when this rectangle has zero width AND zero height (LLX == URX and LLY == URY). |
| `IsTrivial` | `bool` | Read | True when this rectangle equals the Trivial sentinel (-1, -1, -1, -1) used as a "no value" marker by the PDF library. |
| `IsEmpty` | `bool` | Read | Returns true when the rectangle has no positive area — coordinates are inverted (llx >= urx or lly >= ury) or have zero width/height. |

## Methods

| Signature | Description |
|-----------|-------------|
| `Rectangle(llx: double, lly: double, urx: double, ury: double)` | Calls Rectangle on this Rectangle instance. |
| `Rectangle(llx: double, lly: double, urx: double, ury: double, normalizeCoordinates: bool)` | Creates a rectangle. |
| `Clone()` | Returns a shallow copy of this rectangle (matches the canonical object Clone() signature). |
| `Center()` | Geometric centre of the rectangle. |
| `ContainsPoint(x: double, y: double)` | Test whether x, y falls inside the rectangle (inclusive of edges). |
| `Contains(point: Point, inclusive: bool)` | Test whether point falls inside the rectangle. |
| `ContainsLine(x1: double, y1: double, x2: double, y2: double)` | Test whether the line segment (x1,y1) → (x2,y2) lies entirely within the rectangle (both endpoints inside, inclusive of edges). |
| `Contains(x: double, y: double)` | Calls Contains on this Rectangle instance. |
| `Contains(other: Rectangle)` |  |
| `Intersect(otherRect: Rectangle)` | Geometric intersection. |
| `IsIntersect(otherRect: Rectangle)` | True when this rectangle has any area in common with otherRect. |
| `MoveBy(dx: double, dy: double)` | Translate this rectangle by (dx,dy) in place. |
| `Rotate(angle: Rotation)` | Rotate this rectangle in place by the given Rotation. |
| `Rotate(angle: int)` | Rotate this rectangle in place by angle degrees (typically 0/90/180/270; arbitrary angles compute the bounding box of the rotated corner points). |
| `ToPoints()` | The four corners of the rectangle in LL → LR → UR → UL order. |
| `Parse(value: string)` | Parse a rectangle from the canonical "LLX LLY URX URY" form (whitespace- or comma-separated). |
| `Equals(obj: object?)` | Calls Equals on this Rectangle instance. |
| `Equals(other: Rectangle?)` | Coordinate-wise equality with a small floating-point tolerance. |
| `GetHashCode()` | Calls GetHashCode on this Rectangle instance. |
| `NearEquals(other: Rectangle, delta: double)` | Checks whether this rectangle is approximately equal to another within a given tolerance. |
| `Join(otherRect: Rectangle)` | Returns the union (bounding box) of this rectangle and another. |
| `ToString()` | Calls ToString on this Rectangle instance. |
| `FromRect(src: System.Drawing.Rectangle)` | Convert from System.Drawing.Rectangle (x, y, width, height) to PDF Rectangle (LLX/LLY/URX/URY). |
| `FromRect(src: System.Drawing.RectangleF)` | Convert from System.Drawing.RectangleF. |
| `ToRect()` | Convert this PDF Rectangle to System.Drawing.Rectangle. |

## See Also

- [Aspose.PDF for .NET — Enterprise API Reference](https://reference.aspose.com/pdf/net/)