Package com.pd4ml

Class 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, except LEDGER; use rotate() for landscape:
    
     pd4ml.setPageSize(PageSize.A4.rotate());
     
    See Also:
    PD4ML.setPageSize(PageSize)
    • 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 PageSize getInstance​(java.lang.String name)
      Returns a page size by name or by dimensions.
      float mmHeight()
      Intended to return the height in millimeters.
      float mmWidth()
      Intended to return the width in millimeters.
      PageSize rotate()
      Returns the size rotated by 90 degrees, with width and height swapped, for example to turn a portrait format into landscape.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • 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 of TABLOID.
      • 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
        true if the size was created by rotate().
    • 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 width
        height - the page height
        units - the units of the values: millimeters, points, or pixels (converted at Dimensions.PIXELS_PER_POINT pixels 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 points
        height - 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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.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 null if the name is null or not recognized
        Throws:
        java.lang.IllegalArgumentException - declared for the reflective lookup of the constants
        java.lang.IllegalAccessException - declared for the reflective lookup of the constants