org.jfree.report.util
Class PageFormatFactory

java.lang.Object
  extended byorg.jfree.report.util.PageFormatFactory

public final class PageFormatFactory
extends java.lang.Object

The PageFormatFactory is used to create PageFormats on a higher level. The Factory contains templates for all PageSizes defined by Adobe:

Postscript Specifications

Usage for creating an printjob on A4 paper with 2.5 cm border: Paper paper = PageFormatFactory.createPaper (PageFormatFactory.A4); PageFormatFactory.setBordersMm (paper, 25, 25, 25, 25); PageFormat format = PageFormatFactory.createPageFormat (paper, PageFormat.PORTRAIT);

Author:
Thomas Morgner

Field Summary
static int[] A0
          A standard paper size.
static int[] A1
          A standard paper size.
static int[] A10
          A standard paper size.
static int[] A2
          A standard paper size.
static int[] A3
          A standard paper size.
static int[] A3_EXTRA
          A standard paper size.
static int[] A3_EXTRATRANSVERSE
          A standard paper size.
static int[] A3_ROTATED
          A standard paper size.
static int[] A3_TRANSVERSE
          A standard paper size.
static int[] A4
          A standard paper size.
static int[] A4_EXTRA
          A standard paper size.
static int[] A4_PLUS
          A standard paper size.
static int[] A4_ROTATED
          A standard paper size.
static int[] A4_SMALL
          A standard paper size.
static int[] A4_TRANSVERSE
          A standard paper size.
static int[] A5
          A standard paper size.
static int[] A5_EXTRA
          A standard paper size.
static int[] A5_ROTATED
          A standard paper size.
static int[] A5_TRANSVERSE
          A standard paper size.
static int[] A6
          A standard paper size.
static int[] A6_ROTATED
          A standard paper size.
static int[] A7
          A standard paper size.
static int[] A8
          A standard paper size.
static int[] A9
          A standard paper size.
static int[] ANSIC
          A standard paper size.
static int[] ANSID
          A standard paper size.
static int[] ANSIE
          A standard paper size.
static int[] ARCHA
          A standard paper size.
static int[] ARCHB
          A standard paper size.
static int[] ARCHC
          A standard paper size.
static int[] ARCHD
          A standard paper size.
static int[] ARCHE
          A standard paper size.
static int[] B0
          A standard paper size.
static int[] B1
          A standard paper size.
static int[] B10
          A standard paper size.
static int[] B2
          A standard paper size.
static int[] B3
          A standard paper size.
static int[] B4
          A standard paper size.
static int[] B4_ROTATED
          A standard paper size.
static int[] B5
          A standard paper size.
static int[] B5_ROTATED
          A standard paper size.
static int[] B5_TRANSVERSE
          A standard paper size.
static int[] B6
          A standard paper size.
static int[] B6_ROTATED
          A standard paper size.
static int[] B7
          A standard paper size.
static int[] B8
          A standard paper size.
static int[] B9
          A standard paper size.
static int[] C4
          A standard paper size.
static int[] C5
          A standard paper size.
static int[] C6
          A standard paper size.
static int[] COMM10
          A standard paper size.
static int[] DL
          A standard paper size.
static int DOTS_PER_INCH
          Constant for dots per inch.
static int[] DOUBLEPOSTCARD
          A standard paper size.
static int[] DOUBLEPOSTCARD_ROTATED
          A standard paper size.
static int[] ENV10
          A standard paper size.
static int[] ENV11
          A standard paper size.
static int[] ENV12
          A standard paper size.
static int[] ENV14
          A standard paper size.
static int[] ENV9
          A standard paper size.
static int[] ENVC0
          A standard paper size.
static int[] ENVC1
          A standard paper size.
static int[] ENVC2
          A standard paper size.
static int[] ENVC3
          A standard paper size.
static int[] ENVC4
          A standard paper size.
static int[] ENVC5
          A standard paper size.
static int[] ENVC6
          A standard paper size.
static int[] ENVC65
          A standard paper size.
static int[] ENVC7
          A standard paper size.
static int[] ENVCHOU3
          A standard paper size.
static int[] ENVCHOU3_ROTATED
          A standard paper size.
static int[] ENVCHOU4
          A standard paper size.
static int[] ENVCHOU4_ROTATED
          A standard paper size.
static int[] ENVDL
          A standard paper size.
static int[] ENVELOPE
          A standard paper size.
static int[] ENVINVITE
          A standard paper size.
static int[] ENVISOB4
          A standard paper size.
static int[] ENVISOB5
          A standard paper size.
static int[] ENVISOB6
          A standard paper size.
static int[] ENVITALIAN
          A standard paper size.
static int[] ENVKAKU2
          A standard paper size.
static int[] ENVKAKU2_ROTATED
          A standard paper size.
static int[] ENVKAKU3
          A standard paper size.
static int[] ENVKAKU3_ROTATED
          A standard paper size.
static int[] ENVMONARCH
          A standard paper size.
static int[] ENVPERSONAL
          A standard paper size.
static int[] ENVPRC1
          A standard paper size.
static int[] ENVPRC1_ROTATED
          A standard paper size.
static int[] ENVPRC10
          A standard paper size.
static int[] ENVPRC10_ROTATED
          A standard paper size.
static int[] ENVPRC2
          A standard paper size.
static int[] ENVPRC2_ROTATED
          A standard paper size.
static int[] ENVPRC3
          A standard paper size.
static int[] ENVPRC3_ROTATED
          A standard paper size.
static int[] ENVPRC4
          A standard paper size.
static int[] ENVPRC4_ROTATED
          A standard paper size.
static int[] ENVPRC5
          A standard paper size.
static int[] ENVPRC5_ROTATED
          A standard paper size.
static int[] ENVPRC6
          A standard paper size.
static int[] ENVPRC6_ROTATED
          A standard paper size.
static int[] ENVPRC7
          A standard paper size.
static int[] ENVPRC7_ROTATED
          A standard paper size.
static int[] ENVPRC8
          A standard paper size.
static int[] ENVPRC8_ROTATED
          A standard paper size.
static int[] ENVPRC9
          A standard paper size.
static int[] ENVPRC9_ROTATED
          A standard paper size.
static int[] ENVYOU4
          A standard paper size.
static int[] ENVYOU4_ROTATED
          A standard paper size.
static int[] EXECUTIVE
          A standard paper size.
static int[] FANFOLDGERMAN
          A standard paper size.
static int[] FANFOLDGERMANLEGAL
          A standard paper size.
static int[] FANFOLDUS
          A standard paper size.
static int[] FOLIO
          A standard paper size.
static int[] ISOB0
          A standard paper size.
static int[] ISOB1
          A standard paper size.
static int[] ISOB10
          A standard paper size.
static int[] ISOB2
          A standard paper size.
static int[] ISOB3
          A standard paper size.
static int[] ISOB4
          A standard paper size.
static int[] ISOB5
          A standard paper size.
static int[] ISOB5_EXTRA
          A standard paper size.
static int[] ISOB6
          A standard paper size.
static int[] ISOB7
          A standard paper size.
static int[] ISOB8
          A standard paper size.
static int[] ISOB9
          A standard paper size.
static int[] LEDGER
          A standard paper size.
static int[] LEGAL
          A standard paper size.
static int[] LEGAL_EXTRA
          A standard paper size.
static int[] LETTER
          A standard paper size.
static int[] LETTER_EXTRA
          A standard paper size.
static int[] LETTER_EXTRATRANSVERSE
          A standard paper size.
static int[] LETTER_PLUS
          A standard paper size.
static int[] LETTER_ROTATED
          A standard paper size.
static int[] LETTER_SMALL
          A standard paper size.
static int[] LETTER_TRANSVERSE
          A standard paper size.
static int[] MONARCH
          A standard paper size.
static int[] NOTE
          A standard paper size.
static int[] PAPER10X11
          A standard paper size.
static int[] PAPER10X13
          A standard paper size.
static int[] PAPER10X14
          A standard paper size.
static int[] PAPER11X17
          A standard paper size.
static int[] PAPER12X11
          A standard paper size.
static int[] PAPER15X11
          A standard paper size.
static int[] PAPER7X9
          A standard paper size.
static int[] PAPER8X10
          A standard paper size.
static int[] PAPER9X11
          A standard paper size.
static int[] PAPER9X12
          A standard paper size.
static int[] POSTCARD
          A standard paper size.
static int[] POSTCARD_ROTATED
          A standard paper size.
static int[] PRC16K
          A standard paper size.
static int[] PRC16K_ROTATED
          A standard paper size.
static int[] PRC32K
          A standard paper size.
static int[] PRC32K_BIG
          A standard paper size.
static int[] PRC32K_BIGROTATED
          A standard paper size.
static int[] PRC32K_ROTATED
          A standard paper size.
static int[] QUARTO
          A standard paper size.
static int[] STATEMENT
          A standard paper size.
static int[] SUPERA
          A standard paper size.
static int[] SUPERB
          A standard paper size.
static int[] TABLOID
          A standard paper size.
static int[] TABLOIDEXTRA
          A standard paper size.
 
Method Summary
 double convertInchToPoints(double inches)
          Converts the given inch value to a valid point-value.
 double convertMmToPoints(double mm)
          Converts the given millimeter value to a valid point-value.
 java.awt.print.PageFormat createPageFormat(java.lang.Object[] data)
          Restores a page format after it has been serialized.
 java.awt.print.PageFormat createPageFormat(java.awt.print.Paper paper, int orientation)
          Creates a new pageformat using the given paper and the given orientation.
 java.awt.print.Paper createPaper(int[] papersize)
          Creates a paper by using the paper size in points found in the int-array.
 java.awt.print.Paper createPaper(int width, int height)
          Creates a paper by using the paper size in points.
 java.awt.print.Paper createPaper(java.lang.String name)
          Creates a paper by looking up the given Uppercase name in this classes defined constants.
 double getBottomBorder(java.awt.print.Paper p)
          Returns the bottom border of the given paper.
static PageFormatFactory getInstance()
          Returns a single instance of the factory.
 double getLeftBorder(java.awt.print.Paper p)
          Returns the left border of the given paper.
 double getRightBorder(java.awt.print.Paper p)
          Returns the right border of the given paper.
 double getTopBorder(java.awt.print.Paper p)
          Returns the top border of the given paper.
static boolean isEqual(java.awt.print.PageFormat pf1, java.awt.print.PageFormat pf2)
          Tests, whether the given two page format objects are equal.
static void logPageFormat(java.awt.print.PageFormat pf)
          Logs the page format.
static void logPaper(java.awt.print.Paper pf)
          Logs the paper size.
 java.lang.Object[] resolvePageFormat(java.awt.print.PageFormat format)
          Resolves a page format, so that the result can be serialized.
 void setBorders(java.awt.print.Paper paper, double top, double left, double bottom, double right)
          Defines the imageable area of the given paper by adjusting the border around the imagable area.
 void setBordersInch(java.awt.print.Paper paper, double top, double left, double bottom, double right)
          Defines the imageable area of the given paper by adjusting the border around the imagable area.
 void setBordersMm(java.awt.print.Paper paper, double top, double left, double bottom, double right)
          Defines the imageable area of the given paper by adjusting the border around the imagable area.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOTS_PER_INCH

public static final int DOTS_PER_INCH
Constant for dots per inch.

See Also:
Constant Field Values

PAPER11X17

public static final int[] PAPER11X17
A standard paper size.


PAPER10X11

public static final int[] PAPER10X11
A standard paper size.


PAPER10X13

public static final int[] PAPER10X13
A standard paper size.


PAPER10X14

public static final int[] PAPER10X14
A standard paper size.


PAPER12X11

public static final int[] PAPER12X11
A standard paper size.


PAPER15X11

public static final int[] PAPER15X11
A standard paper size.


PAPER7X9

public static final int[] PAPER7X9
A standard paper size.


PAPER8X10

public static final int[] PAPER8X10
A standard paper size.


PAPER9X11

public static final int[] PAPER9X11
A standard paper size.


PAPER9X12

public static final int[] PAPER9X12
A standard paper size.


A0

public static final int[] A0
A standard paper size.


A1

public static final int[] A1
A standard paper size.


A2

public static final int[] A2
A standard paper size.


A3

public static final int[] A3
A standard paper size.


A3_TRANSVERSE

public static final int[] A3_TRANSVERSE
A standard paper size.


A3_EXTRA

public static final int[] A3_EXTRA
A standard paper size.


A3_EXTRATRANSVERSE

public static final int[] A3_EXTRATRANSVERSE
A standard paper size.


A3_ROTATED

public static final int[] A3_ROTATED
A standard paper size.


A4

public static final int[] A4
A standard paper size.


A4_TRANSVERSE

public static final int[] A4_TRANSVERSE
A standard paper size.


A4_EXTRA

public static final int[] A4_EXTRA
A standard paper size.


A4_PLUS

public static final int[] A4_PLUS
A standard paper size.


A4_ROTATED

public static final int[] A4_ROTATED
A standard paper size.


A4_SMALL

public static final int[] A4_SMALL
A standard paper size.


A5

public static final int[] A5
A standard paper size.


A5_TRANSVERSE

public static final int[] A5_TRANSVERSE
A standard paper size.


A5_EXTRA

public static final int[] A5_EXTRA
A standard paper size.


A5_ROTATED

public static final int[] A5_ROTATED
A standard paper size.


A6

public static final int[] A6
A standard paper size.


A6_ROTATED

public static final int[] A6_ROTATED
A standard paper size.


A7

public static final int[] A7
A standard paper size.


A8

public static final int[] A8
A standard paper size.


A9

public static final int[] A9
A standard paper size.


A10

public static final int[] A10
A standard paper size.


ANSIC

public static final int[] ANSIC
A standard paper size.


ANSID

public static final int[] ANSID
A standard paper size.


ANSIE

public static final int[] ANSIE
A standard paper size.


ARCHA

public static final int[] ARCHA
A standard paper size.


ARCHB

public static final int[] ARCHB
A standard paper size.


ARCHC

public static final int[] ARCHC
A standard paper size.


ARCHD

public static final int[] ARCHD
A standard paper size.


ARCHE

public static final int[] ARCHE
A standard paper size.


B0

public static final int[] B0
A standard paper size.


B1

public static final int[] B1
A standard paper size.


B2

public static final int[] B2
A standard paper size.


B3

public static final int[] B3
A standard paper size.


B4

public static final int[] B4
A standard paper size.


B4_ROTATED

public static final int[] B4_ROTATED
A standard paper size.


B5

public static final int[] B5
A standard paper size.


B5_TRANSVERSE

public static final int[] B5_TRANSVERSE
A standard paper size.


B5_ROTATED

public static final int[] B5_ROTATED
A standard paper size.


B6

public static final int[] B6
A standard paper size.


B6_ROTATED

public static final int[] B6_ROTATED
A standard paper size.


B7

public static final int[] B7
A standard paper size.


B8

public static final int[] B8
A standard paper size.


B9

public static final int[] B9
A standard paper size.


B10

public static final int[] B10
A standard paper size.


C4

public static final int[] C4
A standard paper size.


C5

public static final int[] C5
A standard paper size.


C6

public static final int[] C6
A standard paper size.


COMM10

public static final int[] COMM10
A standard paper size.


DL

public static final int[] DL
A standard paper size.


DOUBLEPOSTCARD

public static final int[] DOUBLEPOSTCARD
A standard paper size.


DOUBLEPOSTCARD_ROTATED

public static final int[] DOUBLEPOSTCARD_ROTATED
A standard paper size.


ENV9

public static final int[] ENV9
A standard paper size.


ENV10

public static final int[] ENV10
A standard paper size.


ENV11

public static final int[] ENV11
A standard paper size.


ENV12

public static final int[] ENV12
A standard paper size.


ENV14

public static final int[] ENV14
A standard paper size.


ENVC0

public static final int[] ENVC0
A standard paper size.


ENVC1

public static final int[] ENVC1
A standard paper size.


ENVC2

public static final int[] ENVC2
A standard paper size.


ENVC3

public static final int[] ENVC3
A standard paper size.


ENVC4

public static final int[] ENVC4
A standard paper size.


ENVC5

public static final int[] ENVC5
A standard paper size.


ENVC6

public static final int[] ENVC6
A standard paper size.


ENVC65

public static final int[] ENVC65
A standard paper size.


ENVC7

public static final int[] ENVC7
A standard paper size.


ENVCHOU3

public static final int[] ENVCHOU3
A standard paper size.


ENVCHOU3_ROTATED

public static final int[] ENVCHOU3_ROTATED
A standard paper size.


ENVCHOU4

public static final int[] ENVCHOU4
A standard paper size.


ENVCHOU4_ROTATED

public static final int[] ENVCHOU4_ROTATED
A standard paper size.


ENVDL

public static final int[] ENVDL
A standard paper size.


ENVINVITE

public static final int[] ENVINVITE
A standard paper size.


ENVISOB4

public static final int[] ENVISOB4
A standard paper size.


ENVISOB5

public static final int[] ENVISOB5
A standard paper size.


ENVISOB6

public static final int[] ENVISOB6
A standard paper size.


ENVITALIAN

public static final int[] ENVITALIAN
A standard paper size.


ENVELOPE

public static final int[] ENVELOPE
A standard paper size.


ENVKAKU2

public static final int[] ENVKAKU2
A standard paper size.


ENVKAKU2_ROTATED

public static final int[] ENVKAKU2_ROTATED
A standard paper size.


ENVKAKU3

public static final int[] ENVKAKU3
A standard paper size.


ENVKAKU3_ROTATED

public static final int[] ENVKAKU3_ROTATED
A standard paper size.


ENVMONARCH

public static final int[] ENVMONARCH
A standard paper size.


ENVPERSONAL

public static final int[] ENVPERSONAL
A standard paper size.


ENVPRC1

public static final int[] ENVPRC1
A standard paper size.


ENVPRC1_ROTATED

public static final int[] ENVPRC1_ROTATED
A standard paper size.


ENVPRC2

public static final int[] ENVPRC2
A standard paper size.


ENVPRC2_ROTATED

public static final int[] ENVPRC2_ROTATED
A standard paper size.


ENVPRC3

public static final int[] ENVPRC3
A standard paper size.


ENVPRC3_ROTATED

public static final int[] ENVPRC3_ROTATED
A standard paper size.


ENVPRC4

public static final int[] ENVPRC4
A standard paper size.


ENVPRC4_ROTATED

public static final int[] ENVPRC4_ROTATED
A standard paper size.


ENVPRC5

public static final int[] ENVPRC5
A standard paper size.


ENVPRC5_ROTATED

public static final int[] ENVPRC5_ROTATED
A standard paper size.


ENVPRC6

public static final int[] ENVPRC6
A standard paper size.


ENVPRC6_ROTATED

public static final int[] ENVPRC6_ROTATED
A standard paper size.


ENVPRC7

public static final int[] ENVPRC7
A standard paper size.


ENVPRC7_ROTATED

public static final int[] ENVPRC7_ROTATED
A standard paper size.


ENVPRC8

public static final int[] ENVPRC8
A standard paper size.


ENVPRC8_ROTATED

public static final int[] ENVPRC8_ROTATED
A standard paper size.


ENVPRC9

public static final int[] ENVPRC9
A standard paper size.


ENVPRC9_ROTATED

public static final int[] ENVPRC9_ROTATED
A standard paper size.


ENVPRC10

public static final int[] ENVPRC10
A standard paper size.


ENVPRC10_ROTATED

public static final int[] ENVPRC10_ROTATED
A standard paper size.


ENVYOU4

public static final int[] ENVYOU4
A standard paper size.


ENVYOU4_ROTATED

public static final int[] ENVYOU4_ROTATED
A standard paper size.


EXECUTIVE

public static final int[] EXECUTIVE
A standard paper size.


FANFOLDUS

public static final int[] FANFOLDUS
A standard paper size.


FANFOLDGERMAN

public static final int[] FANFOLDGERMAN
A standard paper size.


FANFOLDGERMANLEGAL

public static final int[] FANFOLDGERMANLEGAL
A standard paper size.


FOLIO

public static final int[] FOLIO
A standard paper size.


ISOB0

public static final int[] ISOB0
A standard paper size.


ISOB1

public static final int[] ISOB1
A standard paper size.


ISOB2

public static final int[] ISOB2
A standard paper size.


ISOB3

public static final int[] ISOB3
A standard paper size.


ISOB4

public static final int[] ISOB4
A standard paper size.


ISOB5

public static final int[] ISOB5
A standard paper size.


ISOB5_EXTRA

public static final int[] ISOB5_EXTRA
A standard paper size.


ISOB6

public static final int[] ISOB6
A standard paper size.


ISOB7

public static final int[] ISOB7
A standard paper size.


ISOB8

public static final int[] ISOB8
A standard paper size.


ISOB9

public static final int[] ISOB9
A standard paper size.


ISOB10

public static final int[] ISOB10
A standard paper size.


LEDGER

public static final int[] LEDGER
A standard paper size.


LEGAL

public static final int[] LEGAL
A standard paper size.


LEGAL_EXTRA

public static final int[] LEGAL_EXTRA
A standard paper size.


LETTER

public static final int[] LETTER
A standard paper size.


LETTER_TRANSVERSE

public static final int[] LETTER_TRANSVERSE
A standard paper size.


LETTER_EXTRA

public static final int[] LETTER_EXTRA
A standard paper size.


LETTER_EXTRATRANSVERSE

public static final int[] LETTER_EXTRATRANSVERSE
A standard paper size.


LETTER_PLUS

public static final int[] LETTER_PLUS
A standard paper size.


LETTER_ROTATED

public static final int[] LETTER_ROTATED
A standard paper size.


LETTER_SMALL

public static final int[] LETTER_SMALL
A standard paper size.


MONARCH

public static final int[] MONARCH
A standard paper size.


NOTE

public static final int[] NOTE
A standard paper size.


POSTCARD

public static final int[] POSTCARD
A standard paper size.


POSTCARD_ROTATED

public static final int[] POSTCARD_ROTATED
A standard paper size.


PRC16K

public static final int[] PRC16K
A standard paper size.


PRC16K_ROTATED

public static final int[] PRC16K_ROTATED
A standard paper size.


PRC32K

public static final int[] PRC32K
A standard paper size.


PRC32K_ROTATED

public static final int[] PRC32K_ROTATED
A standard paper size.


PRC32K_BIG

public static final int[] PRC32K_BIG
A standard paper size.


PRC32K_BIGROTATED

public static final int[] PRC32K_BIGROTATED
A standard paper size.


QUARTO

public static final int[] QUARTO
A standard paper size.


STATEMENT

public static final int[] STATEMENT
A standard paper size.


SUPERA

public static final int[] SUPERA
A standard paper size.


SUPERB

public static final int[] SUPERB
A standard paper size.


TABLOID

public static final int[] TABLOID
A standard paper size.


TABLOIDEXTRA

public static final int[] TABLOIDEXTRA
A standard paper size.

Method Detail

getInstance

public static PageFormatFactory getInstance()
Returns a single instance of the factory.

Returns:
an instance of a PageFormatFactory.

createPaper

public java.awt.print.Paper createPaper(int[] papersize)
Creates a paper by using the paper size in points found in the int-array. The array must have a length of 2 and the first value of this array has to contain the width and the second the height parameter. The created Paper has no ImagableArea defined.

Parameters:
papersize - the definition of the papersize in a 2-element int-array
Returns:
the created paper

createPaper

public java.awt.print.Paper createPaper(int width,
                                        int height)
Creates a paper by using the paper size in points. The created Paper has no ImagableArea defined.

Parameters:
width - the width of the paper in points
height - the height of the paper in points
Returns:
the created paper

setBorders

public void setBorders(java.awt.print.Paper paper,
                       double top,
                       double left,
                       double bottom,
                       double right)
Defines the imageable area of the given paper by adjusting the border around the imagable area. The bordersizes are given in points.

Parameters:
paper - the paper that should be modified
top - the bordersize of the top-border
left - the border in points in the left
bottom - the border in points in the bottom
right - the border in points in the right

setBordersInch

public void setBordersInch(java.awt.print.Paper paper,
                           double top,
                           double left,
                           double bottom,
                           double right)
Defines the imageable area of the given paper by adjusting the border around the imagable area. The bordersizes are given in inches.

Parameters:
paper - the paper that should be modified
top - the bordersize of the top-border
left - the border in points in the left
bottom - the border in points in the bottom
right - the border in points in the right

setBordersMm

public void setBordersMm(java.awt.print.Paper paper,
                         double top,
                         double left,
                         double bottom,
                         double right)
Defines the imageable area of the given paper by adjusting the border around the imagable area. The bordersizes are given in millimeters.

Parameters:
paper - the paper that should be modified
top - the bordersize of the top-border
left - the border in points in the left
bottom - the border in points in the bottom
right - the border in points in the right

convertInchToPoints

public double convertInchToPoints(double inches)
Converts the given inch value to a valid point-value.

Parameters:
inches - the size in inch
Returns:
the size in points

convertMmToPoints

public double convertMmToPoints(double mm)
Converts the given millimeter value to a valid point-value.

Parameters:
mm - the size in inch
Returns:
the size in points

createPageFormat

public java.awt.print.PageFormat createPageFormat(java.awt.print.Paper paper,
                                                  int orientation)
Creates a new pageformat using the given paper and the given orientation.

Parameters:
paper - the paper to use in the new pageformat
orientation - one of PageFormat.PORTRAIT, PageFormat.LANDSCAPE or PageFormat.REVERSE_LANDSCAPE
Returns:
the created Pageformat
Throws:
java.lang.NullPointerException - if the paper given was null

createPaper

public java.awt.print.Paper createPaper(java.lang.String name)
Creates a paper by looking up the given Uppercase name in this classes defined constants. The value if looked up by introspection, if the value is not defined in this class, null is returned.

Parameters:
name - the name of the constant defining the papersize
Returns:
the defined paper or null, if the name was invalid.

logPageFormat

public static void logPageFormat(java.awt.print.PageFormat pf)
Logs the page format.

Parameters:
pf - the page format.

logPaper

public static void logPaper(java.awt.print.Paper pf)
Logs the paper size.

Parameters:
pf - the paper size.

isEqual

public static boolean isEqual(java.awt.print.PageFormat pf1,
                              java.awt.print.PageFormat pf2)
Tests, whether the given two page format objects are equal.

Parameters:
pf1 - the first page format that should be compared.
pf2 - the second page format that should be compared.
Returns:
true, if both page formats are equal, false otherwise.

getLeftBorder

public double getLeftBorder(java.awt.print.Paper p)
Returns the left border of the given paper.

Parameters:
p - the paper that defines the borders.
Returns:
the left border.

getRightBorder

public double getRightBorder(java.awt.print.Paper p)
Returns the right border of the given paper.

Parameters:
p - the paper that defines the borders.
Returns:
the right border.

getTopBorder

public double getTopBorder(java.awt.print.Paper p)
Returns the top border of the given paper.

Parameters:
p - the paper that defines the borders.
Returns:
the top border.

getBottomBorder

public double getBottomBorder(java.awt.print.Paper p)
Returns the bottom border of the given paper.

Parameters:
p - the paper that defines the borders.
Returns:
the bottom border.

resolvePageFormat

public java.lang.Object[] resolvePageFormat(java.awt.print.PageFormat format)
Resolves a page format, so that the result can be serialized.

Parameters:
format - the page format that should be prepared for serialisation.
Returns:
the prepared page format data.

createPageFormat

public java.awt.print.PageFormat createPageFormat(java.lang.Object[] data)
Restores a page format after it has been serialized.

Parameters:
data - the serialized page format data.
Returns:
the restored page format.