Class PaperSize

  • All Implemented Interfaces:
    java.io.Serializable

    public class PaperSize
    extends java.lang.Object
    implements java.io.Serializable
    Defines a paper size. Standard sizes are defined as constants. Check http://ghostscript.com/doc/current/Use.htm#Known_paper_sizes.
    See Also:
    Serialized Form
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Serial UID.
        See Also:
        Constant Field Values
      • index

        private static final java.util.Map<java.lang.String,​PaperSize> index
        Standard paper sizes index map. Allows faster paer size lookup by name.
      • LEDGER

        public static final PaperSize LEDGER
      • LETTER

        public static final PaperSize LETTER
      • width

        private final int width
        Paper width in points.
      • height

        private final int height
        Paper height in points.
      • name

        private java.lang.String name
        Paper name (if standard paper size)
    • Constructor Detail

      • PaperSize

        public PaperSize​(int width,
                         int height)
        Constructor accepting dimensions.
        Parameters:
        width - Width
        height - Height
      • PaperSize

        public PaperSize​(java.lang.String name,
                         int width,
                         int height)
        Constructor accepting dimensions and name.
        Parameters:
        name - Name. If provided, considered as a standard size (will be accessible with the getStandardPaperSize later on).
        width - Width
        height - Height
    • Method Detail

      • scale

        public PaperSize scale​(float factor)
        Returns a scaled PaperSize according to a scale factor.
        Parameters:
        factor - Scale factor
        Returns:
        Scaled PaperSize
      • portrait

        public PaperSize portrait()
        Returns a portrait orientation of the PaperSize.
        Returns:
        A PaperSize.
      • landscape

        public PaperSize landscape()
        Returns a landscape orientation of the PaperSize.
        Returns:
        A PaperSize.
      • getStandardPaperSize

        public static PaperSize getStandardPaperSize​(java.lang.String name)
        Looks for a standard paper size with a given name.
        Parameters:
        name - Paper size name (not case sensitive).
        Returns:
        PaperSize found or null
      • getWidth

        public int getWidth()
      • getHeight

        public int getHeight()
      • getName

        public java.lang.String getName()