Class PaperSize

java.lang.Object
org.ghost4j.document.PaperSize
All Implemented Interfaces:
Serializable

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

    • serialVersionUID

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

      private static final Map<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
    • ARCHE

      public static final PaperSize ARCHE
    • ARCHD

      public static final PaperSize ARCHD
    • ARCHC

      public static final PaperSize ARCHC
    • ARCHB

      public static final PaperSize ARCHB
    • ARCHA

      public static final PaperSize ARCHA
    • A0

      public static final PaperSize A0
    • A1

      public static final PaperSize A1
    • A2

      public static final PaperSize A2
    • A3

      public static final PaperSize A3
    • A4

      public static final PaperSize A4
    • A5

      public static final PaperSize A5
    • A6

      public static final PaperSize A6
    • A7

      public static final PaperSize A7
    • A8

      public static final PaperSize A8
    • A9

      public static final PaperSize A9
    • A10

      public static final PaperSize A10
    • width

      private final int width
      Paper width in points.
    • height

      private final int height
      Paper height in points.
    • name

      private String name
      Paper name (if standard paper size)
  • Constructor Details

    • PaperSize

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

      public PaperSize(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 Details

    • 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(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 String getName()