- java.lang.Object
-
- com.itextpdf.text.pdf.PdfObject
-
- com.itextpdf.text.pdf.PdfArray
-
- com.itextpdf.text.pdf.PdfRectangle
-
public class PdfRectangle extends PdfArray
PdfRectangleis 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
arrayof 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).
-
-
Constructor Summary
Constructors Constructor 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 aPdfRectangle-object.PdfRectangle(float urx, float ury, int rotation)Constructs aPdfRectangle-object starting from the origin (0, 0).PdfRectangle(Rectangle rectangle)PdfRectangle(Rectangle rectangle, int rotation)Constructs aPdfRectangle-object with aRectangle-object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(float[] values)Block changes to the underlying PdfArraybooleanadd(int[] values)Block changes to the underlying PdfArraybooleanadd(PdfObject object)Overrides theadd-method inPdfArrayin order to prevent the adding of extra object to the array.voidaddFirst(PdfObject object)Block changes to the underlying PdfArrayfloatbottom()Returns the lower left y-coordinate.floatbottom(int margin)Returns the lower left y-coordinate, considering a given margin.RectanglegetRectangle()Returns the high level version of this PdfRectanglefloatheight()Returns the height of the rectangle.floatleft()Returns the lower left x-coordinate.floatleft(int margin)Returns the lower left x-coordinate, considering a given margin.floatright()Returns the upper right x-coordinate.floatright(int margin)Returns the upper right x-coordinate, considering a given margin.PdfRectanglerotate()Swaps the values of urx and ury and of lly and llx in order to rotate the rectangle.floattop()Returns the upper right y-coordinate.floattop(int margin)Returns the upper right y-coordinate, considering a given margin.floatwidth()Returns the width of the rectangle.-
Methods inherited from class com.itextpdf.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.itextpdf.text.pdf.PdfObject
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type
-
-
-
-
Constructor Detail
-
PdfRectangle
public PdfRectangle(float llx, float lly, float urx, float ury, int rotation)Constructs aPdfRectangle-object.- Parameters:
llx- lower left xlly- lower left yurx- upper right xury- 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 aPdfRectangle-object starting from the origin (0, 0).- Parameters:
urx- upper right xury- upper right y
-
PdfRectangle
public PdfRectangle(float urx, float ury)
-
PdfRectangle
public PdfRectangle(Rectangle rectangle, int rotation)
Constructs aPdfRectangle-object with aRectangle-object.- Parameters:
rectangle- aRectangle
-
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 theadd-method inPdfArrayin order to prevent the adding of extra object to the array.
-
add
public boolean add(float[] values)
Block changes to the underlying PdfArray
-
add
public boolean add(int[] values)
Block changes to the underlying PdfArray
-
addFirst
public void addFirst(PdfObject object)
Block changes to the underlying PdfArray
-
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
-
-