Package com.pd4ml
Class PageSize
- java.lang.Object
-
- com.pd4ml.PageSize
-
- All Implemented Interfaces:
Dimensions
public class PageSize extends java.lang.Object implements Dimensions
A page size in points (1/72 inch), with constants for the common ISO, JIS, North American and architectural paper formats. All constants are in portrait orientation, exceptLEDGER; userotate()for landscape:pd4ml.setPageSize(PageSize.A4.rotate());- See Also:
PD4ML.setPageSize(PageSize)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.pd4ml.Dimensions
Dimensions.Units
-
-
Field Summary
Fields Modifier and Type Field Description static PageSizeA0ISO A0: 2384 x 3370 points (841 x 1189 mm).static PageSizeA1ISO A1: 1684 x 2384 points (594 x 841 mm).static PageSizeA10ISO A10: 74 x 105 points (26 x 37 mm).static PageSizeA2ISO A2: 1190 x 1684 points (420 x 594 mm).static PageSizeA3ISO A3: 842 x 1190 points (297 x 420 mm).static PageSizeA4ISO A4: 595 x 842 points (210 x 297 mm).static PageSizeA5ISO A5: 421 x 595 points (148 x 210 mm).static PageSizeA6ISO A6: 297 x 421 points (105 x 148 mm).static PageSizeA7ISO A7: 210 x 297 points (74 x 105 mm).static PageSizeA8ISO A8: 148 x 210 points (52 x 74 mm).static PageSizeA9ISO A9: 105 x 148 points (37 x 52 mm).static PageSizeArchAArchitectural A: 648 x 864 points (9 x 12 in).static PageSizeArchBArchitectural B: 864 x 1296 points (12 x 18 in).static PageSizeArchCArchitectural C: 1296 x 1728 points (18 x 24 in).static PageSizeArchDArchitectural D: 1728 x 2592 points (24 x 36 in).static PageSizeArchEArchitectural E: 2592 x 3456 points (36 x 48 in).static PageSizeArchE1Architectural E1: 2160 x 3024 points (30 x 42 in).static PageSizeB4ISO B4: 250 x 353 mm.static PageSizeB5ISO B5: 176 x 250 mm.static PageSizeHALFLETTERHalf Letter (Statement): 396 x 612 points (5.5 x 8.5 in).floatheightThe page height in points.static PageSizeISOB0ISO B0: 2836 x 4008 points (1000 x 1414 mm).static PageSizeISOB1ISO B1: 2004 x 2836 points (707 x 1000 mm).static PageSizeISOB2ISO B2: 1418 x 2004 points (500 x 707 mm).static PageSizeISOB3ISO B3: 1002 x 1418 points (353 x 500 mm).static PageSizeISOB4ISO B4: 709 x 1002 points (250 x 353 mm).static PageSizeISOB5ISO B5: 501 x 709 points (176 x 250 mm).static PageSizeJIS_B4JIS B4 (Japanese standard): 257 x 364 mm.static PageSizeJIS_B5JIS B5 (Japanese standard): 182 x 257 mm.static PageSizeLEDGERLedger: 1224 x 792 points (17 x 11 in), the landscape form ofTABLOID.static PageSizeLEGALUS Legal: 612 x 1008 points (8.5 x 14 in).static PageSizeLETTERUS Letter: 612 x 792 points (8.5 x 11 in).static PageSizeNOTENote: 540 x 720 points (7.5 x 10 in).booleanrotatedtrueif the size was created byrotate().static PageSizeTABLOIDTabloid: 792 x 1224 points (11 x 17 in).floatwidthThe page width in points.-
Fields inherited from interface com.pd4ml.Dimensions
MM_PER_INCH, PIXELS_PER_POINT, POINTS_PER_INCH, POINTS_PER_MM
-
-
Constructor Summary
Constructors Constructor Description PageSize(float width, float height)Creates a page size in points (1/72 inch).PageSize(float width, float height, Dimensions.Units units)Creates a page size in the given units.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PageSizegetInstance(java.lang.String name)Returns a page size by name or by dimensions.floatmmHeight()Intended to return the height in millimeters.floatmmWidth()Intended to return the width in millimeters.PageSizerotate()Returns the size rotated by 90 degrees, with width and height swapped, for example to turn a portrait format into landscape.java.lang.StringtoString()
-
-
-
Field Detail
-
B5
public static final PageSize B5
ISO B5: 176 x 250 mm.
-
B4
public static final PageSize B4
ISO B4: 250 x 353 mm.
-
JIS_B5
public static final PageSize JIS_B5
JIS B5 (Japanese standard): 182 x 257 mm.
-
JIS_B4
public static final PageSize JIS_B4
JIS B4 (Japanese standard): 257 x 364 mm.
-
A10
public static final PageSize A10
ISO A10: 74 x 105 points (26 x 37 mm).
-
A9
public static final PageSize A9
ISO A9: 105 x 148 points (37 x 52 mm).
-
A8
public static final PageSize A8
ISO A8: 148 x 210 points (52 x 74 mm).
-
A7
public static final PageSize A7
ISO A7: 210 x 297 points (74 x 105 mm).
-
A6
public static final PageSize A6
ISO A6: 297 x 421 points (105 x 148 mm).
-
A5
public static final PageSize A5
ISO A5: 421 x 595 points (148 x 210 mm).
-
A4
public static final PageSize A4
ISO A4: 595 x 842 points (210 x 297 mm). The default page size.
-
A3
public static final PageSize A3
ISO A3: 842 x 1190 points (297 x 420 mm).
-
A2
public static final PageSize A2
ISO A2: 1190 x 1684 points (420 x 594 mm).
-
A1
public static final PageSize A1
ISO A1: 1684 x 2384 points (594 x 841 mm).
-
A0
public static final PageSize A0
ISO A0: 2384 x 3370 points (841 x 1189 mm).
-
ISOB5
public static final PageSize ISOB5
ISO B5: 501 x 709 points (176 x 250 mm).
-
ISOB4
public static final PageSize ISOB4
ISO B4: 709 x 1002 points (250 x 353 mm).
-
ISOB3
public static final PageSize ISOB3
ISO B3: 1002 x 1418 points (353 x 500 mm).
-
ISOB2
public static final PageSize ISOB2
ISO B2: 1418 x 2004 points (500 x 707 mm).
-
ISOB1
public static final PageSize ISOB1
ISO B1: 2004 x 2836 points (707 x 1000 mm).
-
ISOB0
public static final PageSize ISOB0
ISO B0: 2836 x 4008 points (1000 x 1414 mm).
-
HALFLETTER
public static final PageSize HALFLETTER
Half Letter (Statement): 396 x 612 points (5.5 x 8.5 in).
-
LETTER
public static final PageSize LETTER
US Letter: 612 x 792 points (8.5 x 11 in).
-
TABLOID
public static final PageSize TABLOID
Tabloid: 792 x 1224 points (11 x 17 in).
-
LEDGER
public static final PageSize LEDGER
Ledger: 1224 x 792 points (17 x 11 in), the landscape form ofTABLOID.
-
NOTE
public static final PageSize NOTE
Note: 540 x 720 points (7.5 x 10 in).
-
LEGAL
public static final PageSize LEGAL
US Legal: 612 x 1008 points (8.5 x 14 in).
-
ArchA
public static final PageSize ArchA
Architectural A: 648 x 864 points (9 x 12 in).
-
ArchB
public static final PageSize ArchB
Architectural B: 864 x 1296 points (12 x 18 in).
-
ArchC
public static final PageSize ArchC
Architectural C: 1296 x 1728 points (18 x 24 in).
-
ArchD
public static final PageSize ArchD
Architectural D: 1728 x 2592 points (24 x 36 in).
-
ArchE
public static final PageSize ArchE
Architectural E: 2592 x 3456 points (36 x 48 in).
-
ArchE1
public static final PageSize ArchE1
Architectural E1: 2160 x 3024 points (30 x 42 in).
-
width
public float width
The page width in points.
-
height
public float height
The page height in points.
-
rotated
public boolean rotated
trueif the size was created byrotate().
-
-
Constructor Detail
-
PageSize
public PageSize(float width, float height, Dimensions.Units units)Creates a page size in the given units. The values are converted to points. If the width or the height is not positive, the other value is used for both; if neither is positive, the size is A4.- Parameters:
width- the page widthheight- the page heightunits- the units of the values: millimeters, points, or pixels (converted atDimensions.PIXELS_PER_POINTpixels per point)
-
PageSize
public PageSize(float width, float height)Creates a page size in points (1/72 inch). If the width or the height is not positive, the other value is used for both; if neither is positive, the size is A4.- Parameters:
width- the page width in pointsheight- the page height in points
-
-
Method Detail
-
rotate
public PageSize rotate()
Returns the size rotated by 90 degrees, with width and height swapped, for example to turn a portrait format into landscape.- Returns:
- the rotated size
-
mmWidth
public float mmWidth()
Intended to return the width in millimeters. Note: the current implementation returns the width multiplied byDimensions.PIXELS_PER_POINT, which is the width in pixels, not in millimeters. To get millimeters, dividewidthbyDimensions.POINTS_PER_MM.- Returns:
- the width multiplied by
Dimensions.PIXELS_PER_POINT
-
mmHeight
public float mmHeight()
Intended to return the height in millimeters. Note: the current implementation returns the height multiplied byDimensions.PIXELS_PER_POINT, which is the height in pixels, not in millimeters. To get millimeters, divideheightbyDimensions.POINTS_PER_MM.- Returns:
- the height multiplied by
Dimensions.PIXELS_PER_POINT
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getInstance
public static PageSize getInstance(java.lang.String name) throws java.lang.IllegalArgumentException, java.lang.IllegalAccessException
Returns a page size by name or by dimensions.- Parameters:
name- the name of one of the constants of this class in lower case, for example "a4", "letter" or "jis_b5", or the dimensions in whole points as "WIDTHxHEIGHT", for example "595x842". Leading and trailing spaces are ignored.- Returns:
- the page size, or
nullif the name isnullor not recognized - Throws:
java.lang.IllegalArgumentException- declared for the reflective lookup of the constantsjava.lang.IllegalAccessException- declared for the reflective lookup of the constants
-
-