Class PdfRectangle
java.lang.Object
com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfObject
com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfArray
com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfRectangle
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 lef 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).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate float
lower left xprivate float
lower left yprivate float
upper right xprivate float
upper right y -
Constructor Summary
ConstructorsConstructorDescriptionPdfRectangle
(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
Modifier and TypeMethodDescriptionboolean
Overrides theadd
-method inPdfArray
in order to prevent the adding of extra object to the array.float
bottom()
Returns the lower left y-coordinate.float
bottom
(int margin) Returns the lower left y-coordinate, considering a given margin.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.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.gitlab.pdftk_java.com.lowagie.text.pdf.PdfArray
add, add, add, addFirst, contains, getArrayList, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getPdfObject, isEmpty, listIterator, remove, set, size, toPdf, toString
Methods inherited from class com.gitlab.pdftk_java.com.lowagie.text.pdf.PdfObject
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type
-
Field Details
-
llx
private float llxlower left x -
lly
private float llylower left y -
urx
private float urxupper right x -
ury
private float uryupper right y
-
-
Constructor Details
-
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
Constructs aPdfRectangle
-object with aRectangle
-object.- Parameters:
rectangle
- aRectangle
-
PdfRectangle
-
-
Method Details
-
add
Overrides theadd
-method inPdfArray
in order to prevent the adding of extra object to the array. -
left
public float left()Returns the lower left x-coordinate.- Returns:
- the lower left x-coordinaat
-
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
Swaps the values of urx and ury and of lly and llx in order to rotate the rectangle.- Returns:
- a
PdfRectangle
-