# Rect Class

> A rect holds four coordinates for a rectangle.

- Product: Adobe PDF Library 21
- Language: .NET Framework
- Version: APDFL21.0.0PlusP1e
- HTML page: https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Rect
- Version index: https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/llms.txt

```csharp
class Rect : SystemIDisposable
```

**Namespace:** `Datalogics::PDFL`

**Inherits from:** `SystemIDisposable`

## Description

A rect holds four coordinates for a rectangle.

The coordinates for a rectangle include left, top, right, bottom. Width () and height () defines the rectangle's width and height. LLx and LLy defines lower left corner, and URx and URy defines the upper right corner.

**Referenced by:** [`Annotation`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Annotation.md), [`AxialShadingPattern`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/AxialShadingPattern.md), [`CircleAnnotation`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/CircleAnnotation.md), [`Container`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Container.md), [`Content`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Content.md), [`Document`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Document.md), [`DrawParams`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/DrawParams.md), [`Element`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Element.md), [`Font`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Font.md), [`Form`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Form.md), [`FreeTextAnnotation`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/FreeTextAnnotation.md), [`Group`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Group.md), [`HighlightAnnotation`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/HighlightAnnotation.md), [`Image`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Image.md), [`InkAnnotation`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/InkAnnotation.md), [`LineAnnotation`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/LineAnnotation.md), [`LinkAnnotation`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/LinkAnnotation.md), [`Page`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Page.md), [`Path`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Path.md), [`PolyLineAnnotation`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/PolyLineAnnotation.md), [`PolygonAnnotation`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/PolygonAnnotation.md), [`PostScript`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/PostScript.md), [`PrintParams`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/PrintParams.md), [`Quad`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Quad.md), [`Rect`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Rect.md), [`Redaction`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Redaction.md), [`RemoteDestination`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/RemoteDestination.md), [`Shading`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Shading.md), [`ShadingPattern`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/ShadingPattern.md), [`SignDoc`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/SignDoc.md), [`SquareAnnotation`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/SquareAnnotation.md), [`Text`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Text.md), [`TextMarkupAnnotation`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/TextMarkupAnnotation.md), [`TextRun`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/TextRun.md), [`UnderlineAnnotation`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/UnderlineAnnotation.md), [`ViewDestination`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/ViewDestination.md)

**Uses types:** [`Matrix`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Matrix.md), [`Rect`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Rect.md)

## Constructors

### Rect

```csharp
Datalogics.PDFL.Rect.Rect()
```

*constructor*

Create a rectangle with all values zero.

### Rect

```csharp
Datalogics.PDFL.Rect.Rect(double nLLx, double nLLy, double nURx, double nURy)
```

*constructor*

**Parameters**

- `nLLx` (`double`): the X coordinate of the lower left corner of the rectangle
- `nLLy` (`double`): the Y coordinate of the lower left corner of the rectangle
- `nURx` (`double`): the X coordinate of the upper right corner of the rectangle
- `nURy` (`double`): the Y coordinate of the upper right corner of the rectangle

Create a Rect.

### Rect

```csharp
Datalogics.PDFL.Rect.Rect(System.Drawing.Rectangle r)
```

*constructor*

**Parameters**

- `r` (`System.Drawing.Rectangle`): The rectangle to convert

Construct a Rect from a System.Drawing.Rectangle

Note that the coordinate systems are inverted for PDFL. Smaller X/Y values are assigned to the lower left coordinate.

### Rect

```csharp
Datalogics.PDFL.Rect.Rect(System.Drawing.RectangleF r)
```

*constructor*

**Parameters**

- `r` (`System.Drawing.RectangleF`): The rectangle to convert

Construct a Rect from a System.Drawing.RectangleF

Note that the coordinate systems are inverted for PDFL. Smaller X/Y values are assigned to the lower left coordinate.

## Properties

### Bottom

```csharp
double Datalogics.PDFL.Rect.Bottom { get; set; }
```

the Y coordinate of the lower left corner of the rectangle

### Height

```csharp
double Datalogics.PDFL.Rect.Height { get; }
```

The height of the Rect.

### LLx

```csharp
double Datalogics.PDFL.Rect.LLx { get; set; }
```

the X coordinate of the lower left corner of the rectangle

### LLy

```csharp
double Datalogics.PDFL.Rect.LLy { get; set; }
```

the Y coordinate of the lower left corner of the rectangle

### Left

```csharp
double Datalogics.PDFL.Rect.Left { get; set; }
```

the X coordinate of the lower left corner of the rectangle

### Right

```csharp
double Datalogics.PDFL.Rect.Right { get; set; }
```

the X coordinate of the upper right corner of the rectangle

### RoundedHeight

```csharp
int Datalogics.PDFL.Rect.RoundedHeight { get; }
```

Calculates and rounds the rectangle's height as APDFL does during page rendering.

The width and height rounding algorithms are different inside APDFL, so in DLE they are different as well.

### RoundedWidth

```csharp
int Datalogics.PDFL.Rect.RoundedWidth { get; }
```

Calculates and rounds the rectangle's width as APDFL does during page rendering.

The width and height rounding algorithms are different inside APDFL, so in DLE they are different as well.

### Top

```csharp
double Datalogics.PDFL.Rect.Top { get; set; }
```

the Y coordinate of the upper right corner of the rectangle

### URx

```csharp
double Datalogics.PDFL.Rect.URx { get; set; }
```

the X coordinate of the upper right corner of the rectangle

### URy

```csharp
double Datalogics.PDFL.Rect.URy { get; set; }
```

the Y coordinate of the upper right corner of the rectangle

### Width

```csharp
double Datalogics.PDFL.Rect.Width { get; }
```

The width of the Rect.

## Methods

### Dispose

```csharp
void Datalogics.PDFL.Rect.Dispose()
```

**Returns:** `void`

### Equals

```csharp
override bool Datalogics.PDFL.Rect.Equals(object obj)
```

**Parameters**

- `obj` (`object`)

**Returns:** `override bool`

### InRect

```csharp
bool Datalogics.PDFL.Rect.InRect(Rect r2)
```

**Parameters**

- `r2` ([`Rect`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Rect.md)): The rectangle to test containment against.

**Returns:** `bool`

true if this rectangle is entirely inside r2, false otherwise.

Check if this rectangle is inside the parameter rectangle.

### Intersect

```csharp
Rect Datalogics.PDFL.Rect.Intersect(Rect r2)
```

**Parameters**

- `r2` ([`Rect`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Rect.md)): The other rectangle to intersect with.

**Returns:** [`Rect`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Rect.md)

A new Rect representing the intersection of the two rectangles.

Obtain the intersection of this rectangle and another rectangle.

### IsEmpty

```csharp
bool Datalogics.PDFL.Rect.IsEmpty()
```

**Returns:** `bool`

true if the rectangle is empty, false otherwise.

Check if this rectangle is empty.

A rectangle is considered empty if its width or height is zero.

### Overlaps

```csharp
bool Datalogics.PDFL.Rect.Overlaps(Rect r2)
```

**Parameters**

- `r2` ([`Rect`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Rect.md)): The other rectangle to test for overlap.

**Returns:** `bool`

true if the two rectangles overlap, false otherwise.

Check if two rectangles overlap.

### ToString

```csharp
override string Datalogics.PDFL.Rect.ToString()
```

**Returns:** `override string`

A string describing the rectangle coordinates in the form "[ LLx=..., LLy=..., URx=..., URy=... ]".

Convert the Rect to a human-readable string representation.

### Transform

```csharp
Rect Datalogics.PDFL.Rect.Transform(Matrix arg0)
```

**Parameters**

- `arg0` ([`Matrix`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Matrix.md))

**Returns:** [`Rect`](https://docs.datalogics.com/apdfl21/DotNetFramework/APDFL21.0.0PlusP1e/class/Rect.md)

A new Rect with the transformed coordinates.

Transform the coordinates of the rectangle by the given Matrix Object.

### operator Rect

```csharp
static implicit Datalogics.PDFL.Rect.operator Rect(System.Drawing.Rectangle r)
```

*static*

**Parameters**

- `r` (`System.Drawing.Rectangle`): The rectangle to convert

**Returns:** `implicit`

Convert a System.Drawing.Rectangle to a Rect

Note that the coordinate systems are inverted for PDFL. Smaller X/Y values are assigned to the lower left coordinate.

### operator Rect

```csharp
static implicit Datalogics.PDFL.Rect.operator Rect(System.Drawing.RectangleF r)
```

*static*

**Parameters**

- `r` (`System.Drawing.RectangleF`): The rectangle to convert

**Returns:** `implicit`

Convert a System.Drawing.RectangleF to a Rect

Note that the coordinate systems are inverted for PDFL. Smaller X/Y values are assigned to the lower left coordinate.
