APIdia Launch Partner
Top Description Fields Constructors Methods
java.awt.print

public Class PageFormat

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Imports
java.awt.geom.AffineTransform, .Point2D, .Rectangle2D, java.lang.annotation.Native

The PageFormat class describes the size and orientation of a page to be printed.

Field Summary

Modifier and TypeField and Description
public static final int
LANDSCAPE

The origin is at the bottom left of the paper with x running bottom to top and y running left to right.

private int
mOrientation

The orientation of the current page.

private Paper
mPaper

A description of the physical piece of paper.

public static final int
PORTRAIT

The origin is at the top left of the paper with x running to the right and y running down the paper.

public static final int
REVERSE_LANDSCAPE

The origin is at the top right of the paper with x running top to bottom and y running right to left.

Constructor Summary

AccessConstructor and Description
public
PageFormat()

Creates a default, portrait-oriented PageFormat.

Method Summary

Modifier and TypeMethod and Description
public Object

Returns:

a copy of this PageFormat.
clone
()

Overrides java.lang.Object.clone.

Makes a copy of this PageFormat with the same contents as this PageFormat.

public double

Returns:

the height of the page.
getHeight
()

Returns the height, in 1/72nds of an inch, of the page.

public double

Returns:

the height of the page.
getImageableHeight
()

Return the height, in 1/72nds of an inch, of the imageable area of the page.

public double

Returns:

the width of the page.
getImageableWidth
()

Returns the width, in 1/72nds of an inch, of the imageable area of the page.

public double

Returns:

the x coordinate of the upper left point of the imageable area of the Paper object associated with this PageFormat.
getImageableX
()

Returns the x coordinate of the upper left point of the imageable area of the Paper object associated with this PageFormat.

public double

Returns:

the y coordinate of the upper left point of the imageable area of the Paper object associated with this PageFormat.
getImageableY
()

Returns the y coordinate of the upper left point of the imageable area of the Paper object associated with this PageFormat.

public double[]

Returns:

the matrix used to translate user space rendering to the orientation of the page.
getMatrix
()

Returns a transformation matrix that translates user space rendering to the requested orientation of the page.

public int

Returns:

this PageFormat object's orientation.
getOrientation
()

Returns the orientation of this PageFormat.

public Paper

Returns:

a copy of the Paper object associated with this PageFormat.
getPaper
()

Returns a copy of the Paper object associated with this PageFormat.

public double

Returns:

the width of the page.
getWidth
()

Returns the width, in 1/72nds of an inch, of the page.

public void
setOrientation(int
the new orientation for the page
orientation
)

Sets the page orientation.

public void
setPaper(Paper
the Paper object to which to set the Paper object for this PageFormat.
paper
)

Sets the Paper object for this PageFormat.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LANDSCAPEback to summary
public static final int LANDSCAPE

The origin is at the bottom left of the paper with x running bottom to top and y running left to right. Note that this is not the Macintosh landscape but is the Window's and PostScript landscape.

Annotations
@Native
mOrientationback to summary
private int mOrientation

The orientation of the current page. This will be one of the constants: PORTRAIT, LANDSCAPE, or REVERSE_LANDSCAPE,

mPaperback to summary
private Paper mPaper

A description of the physical piece of paper.

PORTRAITback to summary
public static final int PORTRAIT

The origin is at the top left of the paper with x running to the right and y running down the paper.

Annotations
@Native
REVERSE_LANDSCAPEback to summary
public static final int REVERSE_LANDSCAPE

The origin is at the top right of the paper with x running top to bottom and y running right to left. Note that this is the Macintosh landscape.

Annotations
@Native

Constructor Detail

PageFormatback to summary
public PageFormat()

Creates a default, portrait-oriented PageFormat.

Method Detail

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Makes a copy of this PageFormat with the same contents as this PageFormat.

Returns:Object

a copy of this PageFormat.

getHeightback to summary
public double getHeight()

Returns the height, in 1/72nds of an inch, of the page. This method takes into account the orientation of the page when determining the height.

Returns:double

the height of the page.

getImageableHeightback to summary
public double getImageableHeight()

Return the height, in 1/72nds of an inch, of the imageable area of the page. This method takes into account the orientation of the page.

Returns:double

the height of the page.

getImageableWidthback to summary
public double getImageableWidth()

Returns the width, in 1/72nds of an inch, of the imageable area of the page. This method takes into account the orientation of the page.

Returns:double

the width of the page.

getImageableXback to summary
public double getImageableX()

Returns the x coordinate of the upper left point of the imageable area of the Paper object associated with this PageFormat. This method takes into account the orientation of the page.

Returns:double

the x coordinate of the upper left point of the imageable area of the Paper object associated with this PageFormat.

getImageableYback to summary
public double getImageableY()

Returns the y coordinate of the upper left point of the imageable area of the Paper object associated with this PageFormat. This method takes into account the orientation of the page.

Returns:double

the y coordinate of the upper left point of the imageable area of the Paper object associated with this PageFormat.

getMatrixback to summary
public double[] getMatrix()

Returns a transformation matrix that translates user space rendering to the requested orientation of the page. The values are placed into the array as { m00, m10, m01, m11, m02, m12} in the form required by the AffineTransform constructor.

Returns:double[]

the matrix used to translate user space rendering to the orientation of the page.

See Also
java.awt.geom.AffineTransform
getOrientationback to summary
public int getOrientation()

Returns the orientation of this PageFormat.

Returns:int

this PageFormat object's orientation.

See Also
setOrientation
getPaperback to summary
public Paper getPaper()

Returns a copy of the Paper object associated with this PageFormat. Changes made to the Paper object returned from this method do not affect the Paper object of this PageFormat. To update the Paper object of this PageFormat, create a new Paper object and set it into this PageFormat by using the setPaper(Paper) method.

Returns:Paper

a copy of the Paper object associated with this PageFormat.

See Also
setPaper
getWidthback to summary
public double getWidth()

Returns the width, in 1/72nds of an inch, of the page. This method takes into account the orientation of the page when determining the width.

Returns:double

the width of the page.

setOrientationback to summary
public void setOrientation(int orientation) throws IllegalArgumentException

Sets the page orientation. orientation must be one of the constants: PORTRAIT, LANDSCAPE, or REVERSE_LANDSCAPE.

Parameters
orientation:int

the new orientation for the page

Exceptions
IllegalArgumentException:
if an unknown orientation was requested
See Also
getOrientation
setPaperback to summary
public void setPaper(Paper paper)

Sets the Paper object for this PageFormat.

Parameters
paper:Paper

the Paper object to which to set the Paper object for this PageFormat.

Exceptions
NullPointerException:
a null paper instance was passed as a parameter.
See Also
getPaper