com.lowagie.text.pdf

## Class PdfRectangle

- java.lang.Object
- - com.lowagie.text.pdf.PdfObject
  - - com.lowagie.text.pdf.PdfArray
    - - com.lowagie.text.pdf.PdfRectangle

-     public class PdfRectangle
      extends PdfArray

  `PdfRectangle` is the PDF Rectangle object.

  Rectangles are used to describe locations on the page and bounding boxes for several objects in PDF, such as fonts. A rectangle is represented as an `array` of four numbers, specifying the lower left x, lower left y, upper right x, and upper right y coordinates of the rectangle, in that order.
  This object is described in the 'Portable Document Format Reference Manual version 1.3' section 7.1 (page 183).

  See Also:
    `Rectangle`, `PdfArray`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private float` | `llx` lower left x
    `private float` | `lly` lower left y
    `private float` | `urx` upper right x
    `private float` | `ury` upper right y

    - ### Fields inherited from class com.lowagie.text.pdf.PdfArray

      `arrayList`

    - ### Fields inherited from class com.lowagie.text.pdf.PdfObject

      `ARRAY, BOOLEAN, bytes, DICTIONARY, INDIRECT, indRef, NAME, NOTHING, NULL, NUMBER, STREAM, STRING, TEXT_PDFDOCENCODING, TEXT_UNICODE, type`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PdfRectangle(float urx, float ury)`
    `PdfRectangle(float llx, float lly, float urx, float ury)`
    `PdfRectangle(float llx, float lly, float urx, float ury, int rotation)` Constructs a `PdfRectangle`-object.
    `PdfRectangle(float urx, float ury, int rotation)` Constructs a `PdfRectangle`-object starting from the origin (0, 0).
    `PdfRectangle(Rectangle rectangle)`
    `PdfRectangle(Rectangle rectangle, int rotation)` Constructs a `PdfRectangle`-object with a `Rectangle`-object.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(float[] values)` Block changes to the underlying PdfArray
    `boolean` | `add(int[] values)` Block changes to the underlying PdfArray
    `boolean` | `add(PdfObject object)` Overrides the `add`-method in `PdfArray` in order to prevent the adding of extra object to the array.
    `void` | `addFirst(PdfObject object)` Block changes to the underlying PdfArray
    `float` | `bottom()` Returns the lower left y-coordinate.
    `float` | `bottom(int margin)` Returns the lower left y-coordinate, considering a given margin.
    `Rectangle` | `getRectangle()` Returns the high level version of this PdfRectangle
    `float` | `height()` Returns the height of the rectangle.
    `float` | `left()` Returns the lower left x-coordinate.
    `float` | `left(int margin)` Returns the lower left x-coordinate, considering a given margin.
    `float` | `right()` Returns the upper right x-coordinate.
    `float` | `right(int margin)` Returns the upper right x-coordinate, considering a given margin.
    `PdfRectangle` | `rotate()` Swaps the values of urx and ury and of lly and llx in order to rotate the rectangle.
    `float` | `top()` Returns the upper right y-coordinate.
    `float` | `top(int margin)` Returns the upper right y-coordinate, considering a given margin.
    `float` | `width()` Returns the width of the rectangle.

    - ### Methods inherited from class com.lowagie.text.pdf.PdfArray

      `add, contains, getArrayList, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getPdfObject, isEmpty, listIterator, remove, set, size, toPdf, toString`

    - ### Methods inherited from class com.lowagie.text.pdf.PdfObject

      `canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### llx

          private float llx

      lower left x

    - #### lly

          private float lly

      lower left y

    - #### urx

          private float urx

      upper right x

    - #### ury

          private float ury

      upper right y

  - ### Constructor Detail

    - #### PdfRectangle

          public PdfRectangle(float llx,
                      float lly,
                      float urx,
                      float ury,
                      int rotation)

      Constructs a `PdfRectangle`-object.
      Parameters:
        `llx` - lower left x
        `lly` - lower left y
        `urx` - upper right x
        `ury` - upper right y
      Since:
        rugPdf0.10

    - #### PdfRectangle

          public PdfRectangle(float llx,
                      float lly,
                      float urx,
                      float ury)

    - #### PdfRectangle

          public PdfRectangle(float urx,
                      float ury,
                      int rotation)

      Constructs a `PdfRectangle`-object starting from the origin (0, 0).
      Parameters:
        `urx` - upper right x
        `ury` - upper right y

    - #### PdfRectangle

          public PdfRectangle(float urx,
                      float ury)

    - #### PdfRectangle

          public PdfRectangle(Rectangle rectangle,
                      int rotation)

      Constructs a `PdfRectangle`-object with a `Rectangle`-object.
      Parameters:
        `rectangle` - a `Rectangle`

    - #### PdfRectangle

          public PdfRectangle(Rectangle rectangle)

  - ### Method Detail

    - #### getRectangle

          public Rectangle getRectangle()

      Returns the high level version of this PdfRectangle
      Returns:
        this PdfRectangle translated to class Rectangle

    - #### add

          public boolean add(PdfObject object)

      Overrides the `add`-method in `PdfArray` in order to prevent the adding of extra object to the array.
      Overrides:
        `add` in class `PdfArray`
      Parameters:
        `object` - `PdfObject` to add (will not be added here)
      Returns:
        `false`

    - #### add

          public boolean add(float[] values)

      Block changes to the underlying PdfArray
      Overrides:
        `add` in class `PdfArray`
      Parameters:
        `values` - stuff we'll ignore. Ha!
      Returns:
        false. You can't add anything to a PdfRectangle
      Since:
        2.1.5

    - #### add

          public boolean add(int[] values)

      Block changes to the underlying PdfArray
      Overrides:
        `add` in class `PdfArray`
      Parameters:
        `values` - stuff we'll ignore. Ha!
      Returns:
        false. You can't add anything to a PdfRectangle
      Since:
        2.1.5

    - #### addFirst

          public void addFirst(PdfObject object)

      Block changes to the underlying PdfArray
      Overrides:
        `addFirst` in class `PdfArray`
      Parameters:
        `object` - Ignored.
      Since:
        2.1.5

    - #### left

          public float left()

      Returns the lower left x-coordinate.
      Returns:
        the lower left x-coordinate

    - #### right

          public float right()

      Returns the upper right x-coordinate.
      Returns:
        the upper right x-coordinate

    - #### top

          public float top()

      Returns the upper right y-coordinate.
      Returns:
        the upper right y-coordinate

    - #### bottom

          public float bottom()

      Returns the lower left y-coordinate.
      Returns:
        the lower left y-coordinate

    - #### left

          public float left(int margin)

      Returns the lower left x-coordinate, considering a given margin.
      Parameters:
        `margin` - a margin
      Returns:
        the lower left x-coordinate

    - #### right

          public float right(int margin)

      Returns the upper right x-coordinate, considering a given margin.
      Parameters:
        `margin` - a margin
      Returns:
        the upper right x-coordinate

    - #### top

          public float top(int margin)

      Returns the upper right y-coordinate, considering a given margin.
      Parameters:
        `margin` - a margin
      Returns:
        the upper right y-coordinate

    - #### bottom

          public float bottom(int margin)

      Returns the lower left y-coordinate, considering a given margin.
      Parameters:
        `margin` - a margin
      Returns:
        the lower left y-coordinate

    - #### width

          public float width()

      Returns the width of the rectangle.
      Returns:
        a width

    - #### height

          public float height()

      Returns the height of the rectangle.
      Returns:
        a height

    - #### rotate

          public PdfRectangle rotate()

      Swaps the values of urx and ury and of lly and llx in order to rotate the rectangle.
      Returns:
        a `PdfRectangle`