PdfBox class
Page rectangle preserving the four numbers from the file.
A PdfPageFormat only carries a width and a height, so it cannot express
a box whose origin is not (0, 0) — the case of any PDF with
/MediaBox [20 30 615 872]. PdfBox keeps llx, lly, urx and ury
exactly as they are in the document, including when the corners come
inverted ([595 842 0 0]), which the specification allows and readers
normalize.
Every geometric query (left, width, intersect, contains) answers over the normalized version; only llx, lly, urx, ury, toList and toPdfArray preserve the original order.
- Annotations
-
- @immutable
Constructors
- PdfBox(double llx, double lly, double urx, double ury)
-
Creates the box from the four raw values, in file order.
const
-
PdfBox.fromArray(PdfArray<
PdfDataType> array) -
Creates the box from a
PdfArrayof four numbers.factory - PdfBox.fromLBWH(double left, double bottom, double width, double height)
-
Creates the box from the lower-left corner and the size.
factory
-
PdfBox.fromList(List<
num> values) -
Creates the box from a list of four numbers.
factory
- PdfBox.fromRect(PdfRect rect)
-
Creates the box matching a PdfRect in user space.
factory
- PdfBox.fromSize(double width, double height)
-
Creates the box with origin at
(0, 0)and the given size.factory
Properties
- bottom → double
-
Smallest y coordinate.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- height → double
-
Height, always positive.
no setter
- horizontalCenter → double
-
Horizontal center.
no setter
- isEmpty → bool
-
Whether the box has no area.
no setter
- isNormalized → bool
-
Whether the corners are already in increasing order.
no setter
- isNotEmpty → bool
-
Whether the box has area.
no setter
- left → double
-
Smallest x coordinate.
no setter
- llx → double
-
X coordinate of the first corner, as it is in the file.
final
- lly → double
-
Y coordinate of the first corner, as it is in the file.
final
- right → double
-
Largest x coordinate.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- top → double
-
Largest y coordinate.
no setter
- urx → double
-
X coordinate of the second corner, as it is in the file.
final
- ury → double
-
Y coordinate of the second corner, as it is in the file.
final
- verticalCenter → double
-
Vertical center.
no setter
- width → double
-
Width, always positive.
no setter
Methods
-
contains(
PdfBox other) → bool -
Whether
otheris entirely contained in this box. -
containsPoint(
double x, double y) → bool -
Whether the point
(x, y)is inside this box, edges included. -
deflate(
double delta) → PdfBox -
Pulls the edges in by
delta, starting from the normalized box. -
inflate(
double delta) → PdfBox -
Pushes the edges out by
delta, starting from the normalized box. -
intersect(
PdfBox other) → PdfBox? -
Intersection with
other, ornullwhen there is no overlap with area. -
normalized(
) → PdfBox - The same box with the corners in increasing order.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toList(
) → List< double> - The four values in file order.
-
toPdfArray(
) → PdfArray< PdfNum> - The four values as the array that goes into the page dictionary.
-
toRect(
) → PdfRect - The normalized box as a PdfRect.
-
toString(
) → String -
A string representation of this object.
override
-
translate(
double dx, double dy) → PdfBox -
Moves the box by
(dx, dy), preserving the corner order.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
tryFromArray(
PdfDataType? value) → PdfBox? - Lenient version of PdfBox.fromArray.
-
tryFromList(
List< num> ? values) → PdfBox? -
Lenient version of PdfBox.fromList: returns
nullinstead of throwing.