Printers usually have hardware margins where they cannot print. A PageLayout instance obtained from a PrinterJob in the context of a specific printer will be correctly set up to print over the whole of that area. If an application adjusts the printable area outside of this bounds, rendering to those areas will be clipped by the device.
Within those hardware margins, the application may define any printable area it needs. The resulting printable area will define the effective dimensions of the page available to the application at printing time.
Applying a PageLayout configured based on one printer, to a job on a different printer may not work correctly, as the second printer may not support the same margins, and may not even support the same Paper. In such a case, the PageLayout must be validated against the new printer.
A PageLayout is immutable.
| Modifier and Type | Field and Description |
|---|---|
| private double | |
| private double | |
| private PageOrientation | |
| private Paper | |
| private double | |
| private double |
| Access | Constructor and Description |
|---|---|
| pack-priv | PageLayout(Paper
the paper to use paper, PageOrientation orientation of the layout orient)Create a PageLayout using the specified Paper size and orientation. |
| pack-priv | PageLayout(Paper
the paper to use paper, PageOrientation orientation of the layout orient, double the left margin in points. leftMargin, double the left margin in points. rightMargin, double the top margin in points. topMargin, double the bottom margin in points. bottomMargin)Note that the margins are to be specified as applying after the rotation due to the orientation. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. Indicates whether some other object is "equal to" this one. |
| public double | Returns: bottom margin in points.Returns the bottom margin of the page layout in points. |
| public double | |
| public PageOrientation | |
| public Paper | |
| public double | Returns: printable height in points.Returns the height dimension of the printable area of the page, in 1/72 of an inch, taking into account the orientation. |
| public double | Returns: printable width in points.Returns the width dimension of the printable area of the page, in 1/72 of an inch points, taking into account the orientation. |
| public double | Returns: right margin in points.Returns the right margin of the page layout in points. |
| public double | |
| public int | |
| public String |
| bMargin | back to summary |
|---|---|
| private double bMargin | |
| lMargin | back to summary |
|---|---|
| private double lMargin | |
| orient | back to summary |
|---|---|
| private PageOrientation orient | |
| paper | back to summary |
|---|---|
| private Paper paper | |
| rMargin | back to summary |
|---|---|
| private double rMargin | |
| tMargin | back to summary |
|---|---|
| private double tMargin | |
| PageLayout | back to summary |
|---|---|
| pack-priv PageLayout(Paper paper, PageOrientation orient) Create a PageLayout using the specified Paper size and orientation. Default margins are 0.75 inch which is 56 points. If the paper dimension is smaller than this, the margins will be reduced.
| |
| PageLayout | back to summary |
|---|---|
| pack-priv PageLayout(Paper paper, PageOrientation orient, double leftMargin, double rightMargin, double topMargin, double bottomMargin) Note that the margins are to be specified as applying after the rotation due to the orientation. Thus the left margin always defines the x origin of the printable area, and the top margin always defines its y origin.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getBottomMargin | back to summary |
|---|---|
| public double getBottomMargin() Returns the bottom margin of the page layout in points. This value is in the orientation of the PageLayout.
| |
| getLeftMargin | back to summary |
|---|---|
| public double getLeftMargin() Returns the left margin of the page layout in points. This value is in the orientation of the PageLayout.
| |
| getPageOrientation | back to summary |
|---|---|
| public PageOrientation getPageOrientation() Gets the
| |
| getPaper | back to summary |
|---|---|
| public Paper getPaper() The paper used.
| |
| getPrintableHeight | back to summary |
|---|---|
| public double getPrintableHeight() Returns the height dimension of the printable area of the page, in 1/72 of an inch, taking into account the orientation. The printable area is width or height reduced by the requested margins on each side. If the requested margins are smaller than the the hardware margins, rendering may be clipped by the device. Since the returned value accounts for orientation, this means if if the orientation is LANDSCAPE or REVERSE_LANDSCAPE, then the top and bottom margins are subtracted from the height of the underlying paper, since it is rotated 90 degrees.
| |
| getPrintableWidth | back to summary |
|---|---|
| public double getPrintableWidth() Returns the width dimension of the printable area of the page, in 1/72 of an inch points, taking into account the orientation. The printable area is width or height reduced by the requested margins on each side. If the requested margins are smaller than the the hardware margins, rendering may be clipped by the device. Since the returned value accounts for orientation, this means if if the orientation is LANDSCAPE or REVERSE_LANDSCAPE, then the left and right margins are subtracted from the height of the underlying paper, since it is rotated 90 degrees.
| |
| getRightMargin | back to summary |
|---|---|
| public double getRightMargin() Returns the right margin of the page layout in points. This value is in the orientation of the PageLayout.
| |
| getTopMargin | back to summary |
|---|---|
| public double getTopMargin() Returns the top margin of the page layout in points. This value is in the orientation of the PageLayout.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |