# Rect Class

> A rect holds four coordinates for a rectangle.

- Product: Adobe PDF Library 18
- Language: Java
- Version: APDFL18.0.5PlusP2e
- HTML page: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Rect
- Version index: https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/llms.txt

```java
class Rect
```

**Namespace:** `com::datalogics::PDFL`

## 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/apdfl18/Java/APDFL18.0.5PlusP2e/class/Annotation.md), [`AxialShadingPattern`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/AxialShadingPattern.md), [`CircleAnnotation`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/CircleAnnotation.md), [`Container`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Container.md), [`Content`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Content.md), [`Document`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Document.md), [`DrawParams`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/DrawParams.md), [`Element`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Element.md), [`Font`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Font.md), [`Form`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Form.md), [`FreeTextAnnotation`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/FreeTextAnnotation.md), [`Group`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Group.md), [`HighlightAnnotation`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/HighlightAnnotation.md), [`Image`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Image.md), [`InkAnnotation`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/InkAnnotation.md), [`LineAnnotation`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/LineAnnotation.md), [`LinkAnnotation`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/LinkAnnotation.md), [`Page`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Page.md), [`Path`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Path.md), [`PolyLineAnnotation`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/PolyLineAnnotation.md), [`PolygonAnnotation`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/PolygonAnnotation.md), [`PostScript`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/PostScript.md), [`PrintParams`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/PrintParams.md), [`Quad`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Quad.md), [`Rect`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Rect.md), [`Redaction`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Redaction.md), [`RemoteDestination`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/RemoteDestination.md), [`Shading`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Shading.md), [`ShadingPattern`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/ShadingPattern.md), [`SignDoc`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/SignDoc.md), [`SquareAnnotation`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/SquareAnnotation.md), [`Text`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Text.md), [`TextMarkupAnnotation`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/TextMarkupAnnotation.md), [`TextRun`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/TextRun.md), [`UnderlineAnnotation`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/UnderlineAnnotation.md), [`ViewDestination`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/ViewDestination.md)

**Uses types:** [`Matrix`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Matrix.md), [`Rect`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Rect.md)

## Constructors

### Rect

```java
com.datalogics.PDFL.Rect.Rect()
```

*constructor*

Create a rectangle with all values zero.

### Rect

```java
com.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

```java
com.datalogics.PDFL.Rect.Rect(java.awt.geom.Rectangle2D r)
```

*constructor*

**Parameters**

- `r` (`java.awt.geom.Rectangle2D`): a rectangle

Create a Rect from a java.awt rectangle type

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

## Methods

### delete

```java
synchronized void com.datalogics.PDFL.Rect.delete(Boolean disposing)
```

*protected*

**Parameters**

- `disposing` (`Boolean`)

**Returns:** `synchronized void`

### delete

```java
synchronized void com.datalogics.PDFL.Rect.delete()
```

**Returns:** `synchronized void`

### equals

```java
boolean com.datalogics.PDFL.Rect.equals(Object rhs)
```

**Parameters**

- `rhs` (`Object`)

**Returns:** `boolean`

### finalize

```java
void com.datalogics.PDFL.Rect.finalize()
```

*protected*

**Returns:** `void`

### getBottom

```java
double com.datalogics.PDFL.Rect.getBottom()
```

**Returns:** `double`

the Y coordinate of the lower left corner of the rectangle.

### getHeight

```java
double com.datalogics.PDFL.Rect.getHeight()
```

**Returns:** `double`

The height of the rectangle (URy - LLy).

The height of the Rect.

### getLLx

```java
double com.datalogics.PDFL.Rect.getLLx()
```

**Returns:** `double`

the X coordinate of the lower left corner of the rectangle.

### getLLy

```java
double com.datalogics.PDFL.Rect.getLLy()
```

**Returns:** `double`

the Y coordinate of the lower left corner of the rectangle.

### getLeft

```java
double com.datalogics.PDFL.Rect.getLeft()
```

**Returns:** `double`

the X coordinate of the lower left corner of the rectangle.

### getRight

```java
double com.datalogics.PDFL.Rect.getRight()
```

**Returns:** `double`

the X coordinate of the upper right corner of the rectangle.

### getTop

```java
double com.datalogics.PDFL.Rect.getTop()
```

**Returns:** `double`

the Y coordinate of the upper right corner of the rectangle.

### getURx

```java
double com.datalogics.PDFL.Rect.getURx()
```

**Returns:** `double`

the X coordinate of the upper right corner of the rectangle.

### getURy

```java
double com.datalogics.PDFL.Rect.getURy()
```

**Returns:** `double`

the Y coordinate of the upper right corner of the rectangle.

### getWidth

```java
double com.datalogics.PDFL.Rect.getWidth()
```

**Returns:** `double`

The width of the rectangle (URx - LLx).

The width of the Rect.

### inRect

```java
boolean com.datalogics.PDFL.Rect.inRect(Rect r2)
```

**Parameters**

- `r2` ([`Rect`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Rect.md)): The rectangle to test containment against.

**Returns:** `boolean`

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

Check if this rectangle is inside the parameter rectangle.

### intersect

```java
Rect com.datalogics.PDFL.Rect.intersect(Rect r2)
```

**Parameters**

- `r2` ([`Rect`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Rect.md)): The other rectangle to intersect with.

**Returns:** [`Rect`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Rect.md)

A new Rect representing the intersection of the two rectangles.

Obtain the intersection of this rectangle and another rectangle.

### isEmpty

```java
boolean com.datalogics.PDFL.Rect.isEmpty()
```

**Returns:** `boolean`

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

```java
boolean com.datalogics.PDFL.Rect.overlaps(Rect r2)
```

**Parameters**

- `r2` ([`Rect`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Rect.md)): The other rectangle to test for overlap.

**Returns:** `boolean`

true if the two rectangles overlap, false otherwise.

Check if two rectangles overlap.

### setBottom

```java
void com.datalogics.PDFL.Rect.setBottom(double bottom)
```

**Parameters**

- `bottom` (`double`)

**Returns:** `void`

the Y coordinate of the lower left corner of the rectangle.

### setLLx

```java
void com.datalogics.PDFL.Rect.setLLx(double value)
```

**Parameters**

- `value` (`double`)

**Returns:** `void`

the X coordinate of the lower left corner of the rectangle.

### setLLy

```java
void com.datalogics.PDFL.Rect.setLLy(double value)
```

**Parameters**

- `value` (`double`)

**Returns:** `void`

the Y coordinate of the lower left corner of the rectangle.

### setLeft

```java
void com.datalogics.PDFL.Rect.setLeft(double left)
```

**Parameters**

- `left` (`double`)

**Returns:** `void`

the X coordinate of the lower left corner of the rectangle.

### setRight

```java
void com.datalogics.PDFL.Rect.setRight(double right)
```

**Parameters**

- `right` (`double`)

**Returns:** `void`

the X coordinate of the upper right corner of the rectangle.

### setTop

```java
void com.datalogics.PDFL.Rect.setTop(double top)
```

**Parameters**

- `top` (`double`)

**Returns:** `void`

the Y coordinate of the upper right corner of the rectangle.

### setURx

```java
void com.datalogics.PDFL.Rect.setURx(double value)
```

**Parameters**

- `value` (`double`)

**Returns:** `void`

the X coordinate of the upper right corner of the rectangle.

### setURy

```java
void com.datalogics.PDFL.Rect.setURy(double value)
```

**Parameters**

- `value` (`double`)

**Returns:** `void`

the Y coordinate of the upper right corner of the rectangle.

### toString

```java
String com.datalogics.PDFL.Rect.toString()
```

**Returns:** `String`

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

Convert the Rect to a human-readable string representation.

### transform

```java
Rect com.datalogics.PDFL.Rect.transform(Matrix arg0)
```

**Parameters**

- `arg0` ([`Matrix`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Matrix.md))

**Returns:** [`Rect`](https://docs.datalogics.com/apdfl18/Java/APDFL18.0.5PlusP2e/class/Rect.md)

A new Rect with the transformed coordinates.

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