Package org.ghost4j.document
Class PaperSize
- java.lang.Object
-
- org.ghost4j.document.PaperSize
-
- All Implemented Interfaces:
java.io.Serializable
public class PaperSize extends java.lang.Object implements java.io.SerializableDefines 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 Summary
Fields Modifier and Type Field Description static PaperSizeA0static PaperSizeA1static PaperSizeA10static PaperSizeA2static PaperSizeA3static PaperSizeA4static PaperSizeA5static PaperSizeA6static PaperSizeA7static PaperSizeA8static PaperSizeA9static PaperSizeARCHAstatic PaperSizeARCHBstatic PaperSizeARCHCstatic PaperSizeARCHDstatic PaperSizeARCHEprivate intheightPaper height in points.private static java.util.Map<java.lang.String,PaperSize>indexStandard paper sizes index map.static PaperSizeLEDGERstatic PaperSizeLEGALstatic PaperSizeLETTERprivate java.lang.StringnamePaper name (if standard paper size)private static longserialVersionUIDSerial UID.private intwidthPaper width in points.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetHeight()java.lang.StringgetName()static PaperSizegetStandardPaperSize(java.lang.String name)Looks for a standard paper size with a given name.intgetWidth()PaperSizelandscape()Returns a landscape orientation of the PaperSize.PaperSizeportrait()Returns a portrait orientation of the PaperSize.PaperSizescale(float factor)Returns a scaled PaperSize according to a scale factor.
-
-
-
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
-
LEGAL
public static final PaperSize LEGAL
-
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 java.lang.String name
Paper name (if standard paper size)
-
-
Constructor Detail
-
PaperSize
public PaperSize(int width, int height)Constructor accepting dimensions.- Parameters:
width- Widthheight- 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- Widthheight- 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()
-
-