- English
- Deutsch
- 日本語
- Français

Category:

I would like to know more about the coordinates of a Rectangle, in particular:

- lower left X
- lower left Y
- upper right X
- upper right Y

Every time, I get confused about how to make dimensions based on these coordinates to draw rectangle. If possible, can I get a graphical representation briefly about these coordinates positions?

Posted on StackOverflow on Jun 10, 2015 by Nazeerbasha

iText 7 Rectangle object has the following parameters:

float x;

float y;

float width;

float height;

Where `x`

and `y`

are the lower-left X, lower-left Y coordinates.

You need to know about the coordinate system as explained in the answer to the question "Where is the origin (x,y) of a PDF page?"

The main thing is that the origin of the coordinate system is (0, 0). Positive X values are to the right of the origin, positive Y values are above the origin. If you need to create a page size, it's also possible to use negative values. Let’s consider two examples:

```
Rectangle rectangle1 = new Rectangle(0, 0, 595, 842);
Rectangle rectangle2 = new Rectangle(20, 35, 100, 150);
```

As you see, `rectangle1`

has (0, 0) coordinate as a lower-left corner and (595, 842) as an upper-right corner, `rectangle2`

has (20, 35) as a lower-left corner and (120, 185) as an upper-right.

Click this link if you want to see how to answer this question in iText 5.