public class BasicPaperFormat extends java.lang.Object implements PaperFormat, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
BasicPaperFormat.Orientation
Helper class for enum describing the orientation of a paper.
|
Modifier and Type | Field and Description |
---|---|
static BasicPaperFormat |
A0_PAPER
A0 paper.
|
static BasicPaperFormat |
A1_PAPER
A1 paper.
|
static BasicPaperFormat |
A2_PAPER
A2 paper.
|
static BasicPaperFormat |
A3_PAPER
A3 paper.
|
static BasicPaperFormat |
A4_PAPER
A4 paper.
|
static BasicPaperFormat |
A5_PAPER
A5 paper.
|
static LengthUnit |
AWT_POINTS
The AWT point unit as used in the java.awt.print.Paper class.
|
static BasicPaperFormat |
B0_PAPER
B0 paper.
|
static BasicPaperFormat |
B1_PAPER
B1 paper.
|
static BasicPaperFormat |
B2_PAPER
B2 paper.
|
static BasicPaperFormat |
B3_PAPER
B3 paper.
|
static BasicPaperFormat |
B4_PAPER
B4 paper.
|
static BasicPaperFormat |
B5_PAPER
B5 paper.
|
static PhysicalLength |
DEFAULT_MARGIN
The default margin size (1 cm).
|
static BasicPaperFormat |
EXECUTIVE_PAPER
Executive format paper.
|
static BasicPaperFormat |
LEGAL_PAPER
Legal format paper.
|
static BasicPaperFormat |
LETTER_PAPER
Letter format paper.
|
static BasicPaperFormat.Orientation |
ORIENTATION_LANDSCAPE
The landscape orientation.
|
static BasicPaperFormat.Orientation |
ORIENTATION_PORTRAIT
The portrait orientation.
|
static BasicPaperFormat.Orientation |
ORIENTATION_SEASCAPE
The seascape orientation.
|
static BasicPaperFormat.Orientation |
ORIENTATION_UPSIDE_DOWN
The upside-down orientation.
|
static BasicPaperFormat[] |
PAPER_FORMATS
Supported paper formats.
|
static BasicPaperFormat |
TABLOID_PAPER
Tabloid format paper.
|
Modifier | Constructor and Description |
---|---|
|
BasicPaperFormat(PaperFormat pf,
PhysicalLength leftMargin,
PhysicalLength rightMargin,
PhysicalLength topMargin,
PhysicalLength bottomMargin)
Copy constructor.
|
|
BasicPaperFormat(PhysicalLength width,
PhysicalLength height,
PhysicalLength margin)
Create a paper format with a uniform margin width.
|
|
BasicPaperFormat(PhysicalLength width,
PhysicalLength height,
PhysicalLength leftMargin,
PhysicalLength rightMargin,
PhysicalLength topMargin,
PhysicalLength bottomMargin)
Create a paper format with a the given margins.
|
|
BasicPaperFormat(java.lang.String name,
PaperFormat basicPaper,
BasicPaperFormat.Orientation rotation)
Create a paper from another with a possible rotation.
|
protected |
BasicPaperFormat(java.lang.String name,
java.lang.String isoName,
double width,
double height)
Internal constructor assuming mm units and default margin
used for construction of basic papers.
|
|
BasicPaperFormat(java.lang.String name,
java.lang.String isoName,
PaperFormat basicPaper,
BasicPaperFormat.Orientation rotation)
Create a paper from another with a possible rotation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o)
Is this paper format equal to another format.
|
boolean |
equalSized(PaperFormat other)
Does the other paper have the same size and margins?
|
static BasicPaperFormat |
fromPageFormat(java.awt.print.PageFormat pageFormat)
Creat an internal paper format from a Java AWT page format.
|
static BasicPaperFormat |
fromPaper(java.awt.print.Paper paper)
Create an internal paper format from a Java AWT paper.
|
PhysicalLength |
getBottomMargin()
Get the bottom margin size.
|
PhysicalLength |
getHeight()
Get the paper's height.
|
static PhysicalLength |
getInnerHeight(PaperFormat format)
Get the height of the printable area.
|
static PhysicalLength |
getInnerWidth(PaperFormat format)
Get the width of the printable area.
|
PhysicalLength |
getLeftMargin()
Get the left margin size.
|
javax.print.attribute.standard.MediaPrintableArea |
getMediaPrintableArea()
Get the printable area of the paper.
|
javax.print.attribute.standard.MediaSize |
getMediaSize()
Get the media size.
|
java.lang.String |
getName()
Get the name of the paper format.
|
static BasicPaperFormat |
getPaperFormat(java.lang.String paperName)
Get the predefined paper format for a given name.
|
PhysicalLength |
getRightMargin()
Get the right margin size.
|
PhysicalLength |
getTopMargin()
Get the top margin size.
|
PhysicalLength |
getWidth()
Get the paper's width.
|
int |
hashCode()
Get a hashcode.
|
BasicPaperFormat |
toLandScape()
Get this paper format in landscape orientation.
|
static java.awt.print.Paper |
toPaper(PaperFormat paperFormat)
Create a Java AWT paper from an internal paper format.
|
BasicPaperFormat |
toSeaScape()
Get this paper format in seascape orientation.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
BasicPaperFormat |
toUpsideDown()
Get this paper format in upside down orientation.
|
public static final BasicPaperFormat.Orientation ORIENTATION_PORTRAIT
public static final BasicPaperFormat.Orientation ORIENTATION_LANDSCAPE
public static final BasicPaperFormat.Orientation ORIENTATION_UPSIDE_DOWN
public static final BasicPaperFormat.Orientation ORIENTATION_SEASCAPE
public static final LengthUnit AWT_POINTS
public static final PhysicalLength DEFAULT_MARGIN
public static final BasicPaperFormat A5_PAPER
public static final BasicPaperFormat A4_PAPER
public static final BasicPaperFormat A3_PAPER
public static final BasicPaperFormat A2_PAPER
public static final BasicPaperFormat A1_PAPER
public static final BasicPaperFormat A0_PAPER
public static final BasicPaperFormat B5_PAPER
public static final BasicPaperFormat B4_PAPER
public static final BasicPaperFormat B3_PAPER
public static final BasicPaperFormat B2_PAPER
public static final BasicPaperFormat B1_PAPER
public static final BasicPaperFormat B0_PAPER
public static final BasicPaperFormat LETTER_PAPER
public static final BasicPaperFormat LEGAL_PAPER
public static final BasicPaperFormat EXECUTIVE_PAPER
public static final BasicPaperFormat TABLOID_PAPER
public static final BasicPaperFormat[] PAPER_FORMATS
protected BasicPaperFormat(@Nullable java.lang.String name, @Nullable java.lang.String isoName, double width, double height)
name
- paper format nameisoName
- ISO name as in RFC 2911width
- width in mmheight
- height in mmpublic BasicPaperFormat(@Nullable java.lang.String name, @NotNull PaperFormat basicPaper, @NotNull BasicPaperFormat.Orientation rotation)
name
- name for the newly created paperbasicPaper
- paper from which to construct the new paperrotation
- orientation to use, assuming the basicPaper
is in portrait formatpublic BasicPaperFormat(@Nullable java.lang.String name, @Nullable java.lang.String isoName, @NotNull PaperFormat basicPaper, @NotNull BasicPaperFormat.Orientation rotation)
name
- name for the newly created paperisoName
- ISO name as in RFC 2911basicPaper
- paper from which to construct the new paperrotation
- orientation to use, assuming the basicPaper
is in portrait formatpublic BasicPaperFormat(@NotNull PhysicalLength width, @NotNull PhysicalLength height, @NotNull PhysicalLength margin)
width
- paper widthheight
- paper heightmargin
- uniform margin sizepublic BasicPaperFormat(@NotNull PhysicalLength width, @NotNull PhysicalLength height, @NotNull PhysicalLength leftMargin, @NotNull PhysicalLength rightMargin, @NotNull PhysicalLength topMargin, @NotNull PhysicalLength bottomMargin)
width
- paper widthheight
- paper heightleftMargin
- left margin widthrightMargin
- right margin widthtopMargin
- top margin widthbottomMargin
- bottom margin widthpublic BasicPaperFormat(@NotNull PaperFormat pf, @NotNull PhysicalLength leftMargin, @NotNull PhysicalLength rightMargin, @NotNull PhysicalLength topMargin, @NotNull PhysicalLength bottomMargin)
pf
- basic paper format to copyleftMargin
- left margin widthrightMargin
- right margin widthtopMargin
- top margin widthbottomMargin
- bottom margin width@NotNull public PhysicalLength getWidth()
getWidth
in interface PaperFormat
@NotNull public PhysicalLength getHeight()
getHeight
in interface PaperFormat
@NotNull public PhysicalLength getLeftMargin()
getLeftMargin
in interface PaperFormat
@NotNull public PhysicalLength getRightMargin()
getRightMargin
in interface PaperFormat
@NotNull public PhysicalLength getTopMargin()
getTopMargin
in interface PaperFormat
@NotNull public PhysicalLength getBottomMargin()
getBottomMargin
in interface PaperFormat
@Nullable public java.lang.String getName()
getName
in interface PaperFormat
null
@NotNull public static PhysicalLength getInnerWidth(PaperFormat format)
format
- paper format@NotNull public static PhysicalLength getInnerHeight(PaperFormat format)
format
- paper format@NotNull public BasicPaperFormat toLandScape()
@NotNull public BasicPaperFormat toSeaScape()
@NotNull public BasicPaperFormat toUpsideDown()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- object to compare topublic int hashCode()
hashCode
in class java.lang.Object
public boolean equalSized(@NotNull PaperFormat other)
other
- other papertrue
if the other paper and this paper have equal size and margins@NotNull public javax.print.attribute.standard.MediaSize getMediaSize()
@NotNull public javax.print.attribute.standard.MediaPrintableArea getMediaPrintableArea()
@Nullable public static BasicPaperFormat getPaperFormat(@Nullable java.lang.String paperName)
paperName
- paper format namenull
@NotNull public static java.awt.print.Paper toPaper(@NotNull PaperFormat paperFormat)
paperFormat
- paper format@NotNull public static BasicPaperFormat fromPaper(@NotNull java.awt.print.Paper paper)
paper
- Java AWT paper@NotNull public static BasicPaperFormat fromPageFormat(@NotNull java.awt.print.PageFormat pageFormat)
pageFormat
- page formatpublic java.lang.String toString()
toString
in class java.lang.Object