Java Code Examples for javax.print.attribute.standard.MediaPrintableArea#INCH

The following examples show how to use javax.print.attribute.standard.MediaPrintableArea#INCH . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RasterPrinterJob.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page,
        double w, double h) {
    double ix, iw, iy, ih;
        if (w >= 72.0 * 6.0) {
            ix = 72.0;
            iw = w - 2 * 72.0;
        } else {
            ix = w / 6.0;
            iw = w * 0.75;
        }
        if (h >= 72.0 * 6.0) {
            iy = 72.0;
            ih = h - 2 * 72.0;
        } else {
            iy = h / 6.0;
            ih = h * 0.75;
        }

    return new MediaPrintableArea((float) (ix / DPI), (float) (iy / DPI),
            (float) (iw / DPI), (float) (ih / DPI), MediaPrintableArea.INCH);
}
 
Example 2
Source File: RasterPrinterJob.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page,
        double w, double h) {
    double ix, iw, iy, ih;
        if (w >= 72.0 * 6.0) {
            ix = 72.0;
            iw = w - 2 * 72.0;
        } else {
            ix = w / 6.0;
            iw = w * 0.75;
        }
        if (h >= 72.0 * 6.0) {
            iy = 72.0;
            ih = h - 2 * 72.0;
        } else {
            iy = h / 6.0;
            ih = h * 0.75;
        }

    return new MediaPrintableArea((float) (ix / DPI), (float) (iy / DPI),
            (float) (iw / DPI), (float) (ih / DPI), MediaPrintableArea.INCH);
}
 
Example 3
Source File: RasterPrinterJob.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page,
        double w, double h) {
    double ix, iw, iy, ih;
        if (w >= 72.0 * 6.0) {
            ix = 72.0;
            iw = w - 2 * 72.0;
        } else {
            ix = w / 6.0;
            iw = w * 0.75;
        }
        if (h >= 72.0 * 6.0) {
            iy = 72.0;
            ih = h - 2 * 72.0;
        } else {
            iy = h / 6.0;
            ih = h * 0.75;
        }

    return new MediaPrintableArea((float) (ix / DPI), (float) (iy / DPI),
            (float) (iw / DPI), (float) (ih / DPI), MediaPrintableArea.INCH);
}
 
Example 4
Source File: RasterPrinterJob.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page,
        double w, double h) {
    double ix, iw, iy, ih;
        if (w >= 72.0 * 6.0) {
            ix = 72.0;
            iw = w - 2 * 72.0;
        } else {
            ix = w / 6.0;
            iw = w * 0.75;
        }
        if (h >= 72.0 * 6.0) {
            iy = 72.0;
            ih = h - 2 * 72.0;
        } else {
            iy = h / 6.0;
            ih = h * 0.75;
        }

    return new MediaPrintableArea((float) (ix / DPI), (float) (iy / DPI),
            (float) (iw / DPI), (float) (ih / DPI), MediaPrintableArea.INCH);
}
 
Example 5
Source File: RasterPrinterJob.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page,
        double w, double h) {
    double ix, iw, iy, ih;
        if (w >= 72.0 * 6.0) {
            ix = 72.0;
            iw = w - 2 * 72.0;
        } else {
            ix = w / 6.0;
            iw = w * 0.75;
        }
        if (h >= 72.0 * 6.0) {
            iy = 72.0;
            ih = h - 2 * 72.0;
        } else {
            iy = h / 6.0;
            ih = h * 0.75;
        }

    return new MediaPrintableArea((float) (ix / DPI), (float) (iy / DPI),
            (float) (iw / DPI), (float) (ih / DPI), MediaPrintableArea.INCH);
}
 
Example 6
Source File: RasterPrinterJob.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page,
        double w, double h) {
    double ix, iw, iy, ih;
        if (w >= 72.0 * 6.0) {
            ix = 72.0;
            iw = w - 2 * 72.0;
        } else {
            ix = w / 6.0;
            iw = w * 0.75;
        }
        if (h >= 72.0 * 6.0) {
            iy = 72.0;
            ih = h - 2 * 72.0;
        } else {
            iy = h / 6.0;
            ih = h * 0.75;
        }

    return new MediaPrintableArea((float) (ix / DPI), (float) (iy / DPI),
            (float) (iw / DPI), (float) (ih / DPI), MediaPrintableArea.INCH);
}
 
Example 7
Source File: RasterPrinterJob.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page,
        double w, double h) {
    double ix, iw, iy, ih;
        if (w >= 72.0 * 6.0) {
            ix = 72.0;
            iw = w - 2 * 72.0;
        } else {
            ix = w / 6.0;
            iw = w * 0.75;
        }
        if (h >= 72.0 * 6.0) {
            iy = 72.0;
            ih = h - 2 * 72.0;
        } else {
            iy = h / 6.0;
            ih = h * 0.75;
        }

    return new MediaPrintableArea((float) (ix / DPI), (float) (iy / DPI),
            (float) (iw / DPI), (float) (ih / DPI), MediaPrintableArea.INCH);
}
 
Example 8
Source File: RasterPrinterJob.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page,
        double w, double h) {
    double ix, iw, iy, ih;
    if (w >= 72.0 * 6.0) {
        ix = 72.0;
        iw = w - 2 * 72.0;
    } else {
        ix = w / 6.0;
        iw = w * 0.75;
    }
    if (h >= 72.0 * 6.0) {
        iy = 72.0;
        ih = h - 2 * 72.0;
    } else {
        iy = h / 6.0;
        ih = h * 0.75;
    }

    return new MediaPrintableArea((float) (ix / DPI), (float) (iy / DPI),
            (float) (iw / DPI), (float) (ih / DPI), MediaPrintableArea.INCH);
}
 
Example 9
Source File: RasterPrinterJob.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page,
        double w, double h) {
    double ix, iw, iy, ih;
    if (w >= 72.0 * 6.0) {
        ix = 72.0;
        iw = w - 2 * 72.0;
    } else {
        ix = w / 6.0;
        iw = w * 0.75;
    }
    if (h >= 72.0 * 6.0) {
        iy = 72.0;
        ih = h - 2 * 72.0;
    } else {
        iy = h / 6.0;
        ih = h * 0.75;
    }

    return new MediaPrintableArea((float) (ix / DPI), (float) (iy / DPI),
            (float) (iw / DPI), (float) (ih / DPI), MediaPrintableArea.INCH);
}
 
Example 10
Source File: RasterPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page,
        double w, double h) {
    double ix, iw, iy, ih;
        if (w >= 72.0 * 6.0) {
            ix = 72.0;
            iw = w - 2 * 72.0;
        } else {
            ix = w / 6.0;
            iw = w * 0.75;
        }
        if (h >= 72.0 * 6.0) {
            iy = 72.0;
            ih = h - 2 * 72.0;
        } else {
            iy = h / 6.0;
            ih = h * 0.75;
        }

    return new MediaPrintableArea((float) (ix / DPI), (float) (iy / DPI),
            (float) (iw / DPI), (float) (ih / DPI), MediaPrintableArea.INCH);
}
 
Example 11
Source File: Win32PrintService.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private boolean isSupportedMediaPrintableArea(MediaPrintableArea mpa) {

        getMediaPrintables(null);
        int units = MediaPrintableArea.INCH;

        if (mediaPrintables != null) {
            for (int i=0; i<mediaPrintables.length; i++) {
                if ((mpa.getX(units) >= mediaPrintables[i].getX(units)) &&
                    (mpa.getY(units) >= mediaPrintables[i].getY(units)) &&
                    (mpa.getX(units) + mpa.getWidth(units) <=
                            mediaPrintables[i].getX(units) +
                            mediaPrintables[i].getWidth(units)) &&
                    (mpa.getY(units) + mpa.getHeight(units) <=
                            mediaPrintables[i].getY(units) +
                            mediaPrintables[i].getHeight(units))) {
                    return true;
                }
            }
        }
        return false;
    }
 
Example 12
Source File: CPrinterJob.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page, double w, double h) {
    final float dpi = 72.0f;
    Paper paper = page.getPaper();
    return new MediaPrintableArea(
            (float) (paper.getImageableX() / dpi),
            (float) (paper.getImageableY() / dpi),
            (float) (paper.getImageableWidth() / dpi),
            (float) (paper.getImageableHeight() / dpi),
            MediaPrintableArea.INCH);
}
 
Example 13
Source File: CPrinterJob.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page, double w, double h) {
    final float dpi = 72.0f;
    Paper paper = page.getPaper();
    return new MediaPrintableArea(
            (float) (paper.getImageableX() / dpi),
            (float) (paper.getImageableY() / dpi),
            (float) (paper.getImageableWidth() / dpi),
            (float) (paper.getImageableHeight() / dpi),
            MediaPrintableArea.INCH);
}
 
Example 14
Source File: CPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page, double w, double h) {
    final float dpi = 72.0f;
    Paper paper = page.getPaper();
    return new MediaPrintableArea(
            (float) (paper.getImageableX() / dpi),
            (float) (paper.getImageableY() / dpi),
            (float) (paper.getImageableWidth() / dpi),
            (float) (paper.getImageableHeight() / dpi),
            MediaPrintableArea.INCH);
}
 
Example 15
Source File: CPrinterJob.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page, double w, double h) {
    final float dpi = 72.0f;
    Paper paper = page.getPaper();
    return new MediaPrintableArea(
            (float) (paper.getImageableX() / dpi),
            (float) (paper.getImageableY() / dpi),
            (float) (paper.getImageableWidth() / dpi),
            (float) (paper.getImageableHeight() / dpi),
            MediaPrintableArea.INCH);
}
 
Example 16
Source File: CPrinterJob.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page, double w, double h) {
    final float dpi = 72.0f;
    Paper paper = page.getPaper();
    return new MediaPrintableArea(
            (float) (paper.getImageableX() / dpi),
            (float) (paper.getImageableY() / dpi),
            (float) (paper.getImageableWidth() / dpi),
            (float) (paper.getImageableHeight() / dpi),
            MediaPrintableArea.INCH);
}
 
Example 17
Source File: CPrinterJob.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page, double w, double h) {
    final float dpi = 72.0f;
    Paper paper = page.getPaper();
    return new MediaPrintableArea(
            (float) (paper.getImageableX() / dpi),
            (float) (paper.getImageableY() / dpi),
            (float) (paper.getImageableWidth() / dpi),
            (float) (paper.getImageableHeight() / dpi),
            MediaPrintableArea.INCH);
}
 
Example 18
Source File: CPrinterJob.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page, double w, double h) {
    final float dpi = 72.0f;
    Paper paper = page.getPaper();
    return new MediaPrintableArea(
            (float) (paper.getImageableX() / dpi),
            (float) (paper.getImageableY() / dpi),
            (float) (paper.getImageableWidth() / dpi),
            (float) (paper.getImageableHeight() / dpi),
            MediaPrintableArea.INCH);
}
 
Example 19
Source File: CPrinterJob.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page, double w, double h) {
    final float dpi = 72.0f;
    Paper paper = page.getPaper();
    return new MediaPrintableArea(
            (float) (paper.getImageableX() / dpi),
            (float) (paper.getImageableY() / dpi),
            (float) (paper.getImageableWidth() / dpi),
            (float) (paper.getImageableHeight() / dpi),
            MediaPrintableArea.INCH);
}
 
Example 20
Source File: CPrinterJob.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected MediaPrintableArea getDefaultPrintableArea(PageFormat page, double w, double h) {
    final float dpi = 72.0f;
    Paper paper = page.getPaper();
    return new MediaPrintableArea(
            (float) (paper.getImageableX() / dpi),
            (float) (paper.getImageableY() / dpi),
            (float) (paper.getImageableWidth() / dpi),
            (float) (paper.getImageableHeight() / dpi),
            MediaPrintableArea.INCH);
}