Getting the Dimensions of a Printed Page - Java 2D Graphics

Java examples for 2D Graphics:Print

Description

Getting the Dimensions of a Printed Page

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;
}

Related Tutorials