This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


java.awt.print
class PageFormat

java.lang.Object extended by java.awt.print.PageFormat
All Implemented Interfaces:
Cloneable

Most common way to construct:

PrinterJob job = …;

PageFormat landscape = job.defaultPage();

Based on 79 examples


public class PageFormat
extends Object
implements Cloneable

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


Field Summary
static int LANDSCAPE
          The origin is at the bottom left of the paper with x running bottom to top and y running left to right.
static int PORTRAIT
          The origin is at the top left of the paper with x running to the right and y running down the paper.
static 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

          Creates a default, portrait-oriented PageFormat.
 
Method Summary
 Object

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

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

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

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

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

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

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

          Returns the orientation of this PageFormat.
 Paper

          Returns a copy of the java.awt.print.Paper object associated with this PageFormat.
 double

          Returns the width, in 1/72nds of an inch, of the page.
 void
setOrientation(int orientation)

          Sets the page orientation.
 void
setPaper(Paper paper)

          Sets the Paper object for this PageFormat.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LANDSCAPE

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.

PORTRAIT

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.

REVERSE_LANDSCAPE

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.
Constructor Detail

PageFormat

public PageFormat()
Creates a default, portrait-oriented PageFormat.

Method Detail

clone

public Object clone()
Makes a copy of this PageFormat with the same contents as this PageFormat.

Overrides:
clone in class Object
Returns:
a copy of this PageFormat.

getHeight

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:
the height of the page.

getImageableHeight

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:
the height of the page.

getImageableWidth

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:
the width of the page.

getImageableX

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:
the x coordinate of the upper left point of the imageable area of the Paper object associated with this PageFormat.

getImageableY

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:
the y coordinate of the upper left point of the imageable area of the Paper object associated with this PageFormat.

getMatrix

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 {@link AffineTransform} constructor.

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

getOrientation

public int getOrientation()
Returns the orientation of this PageFormat.

Returns:
this PageFormat object's orientation.

getPaper

public Paper getPaper()
Returns a copy of the {@link 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 {@link #setPaper(Paper)} method.

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

getWidth

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:
the width of the page.

setOrientation

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 - the new orientation for the page
Throws:
IllegalArgumentException - if an unknown orientation was requested

setPaper

public void setPaper(Paper paper)
Sets the Paper object for this PageFormat.

Parameters:
paper - the Paper object to which to set the Paper object for this PageFormat.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.