![]() |
The Java Developers Almanac 1.4 |
|
e682. Getting the Dimensions of a Printed PageNote that (0, 0) of theGraphics object is at the top-left of the
actual page, which is outside the printable area.
public int print(Graphics g, PageFormat pf, int pageIndex) {
// The area of the printable area.
double ix = pf.getImageableX();
double iy = pf.getImageableY();
double iw = pf.getImageableWidth();
double ih = pf.getImageableHeight();
// The area of the actual page.
double x = 0;
double y = 0;
double w = pf.getWidth();
double h = pf.getHeight();
return Printable.NO_SUCH_PAGE;
}
e683. Setting the Orientation of a Printed Page e684. Printing Pages with Different Formats e685. Displaying the Page Format Dialog e686. Displaying the Print Dialog © 2002 Addison-Wesley. |