Java Code Examples for java.awt.print.Paper#getImageableHeight()
The following examples show how to use
java.awt.print.Paper#getImageableHeight() .
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: PageFormatPreviewPane.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 6 votes |
/** * Describes the physical output characteristics like page size, margins, and imaginable area. * * @return */ public PageFormat getPageFormat() { if ( pageDefinition == null ) { return new PageFormat(); } final PageFormat pageFormat = pageDefinition.getPageFormat(); final Paper orgPaper = pageFormat.getPaper(); final PageFormatFactory pff = PageFormatFactory.getInstance(); final double virtualPaperWidth = orgPaper.getImageableWidth() + pff.getLeftBorder( orgPaper ) + pff.getRightBorder( orgPaper ); final double virtualPaperHeight = orgPaper.getImageableHeight() + pff.getTopBorder( orgPaper ) + pff.getBottomBorder( orgPaper ); final Paper p = pff.createPaper( virtualPaperWidth, virtualPaperHeight ); pff.setBorders( p, pff.getTopBorder( orgPaper ), pff.getLeftBorder( orgPaper ), pff.getBottomBorder( orgPaper ), pff.getRightBorder( orgPaper ) ); return pff.createPageFormat( p, pageFormat.getOrientation() ); }
Example 2
Source File: PageFormatFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 5 votes |
/** * Tests, whether the given two page format objects are equal. * * @param pf1 * the first page format that should be compared. * @param pf2 * the second page format that should be compared. * @return true, if both page formats are equal, false otherwise. */ public static boolean isEqual( final PageFormat pf1, final PageFormat pf2 ) { if ( pf1 == pf2 ) { return true; } if ( pf1 == null || pf2 == null ) { return false; } if ( pf1.getOrientation() != pf2.getOrientation() ) { return false; } final Paper p1 = pf1.getPaper(); final Paper p2 = pf2.getPaper(); if ( p1.getWidth() != p2.getWidth() ) { return false; } if ( p1.getHeight() != p2.getHeight() ) { return false; } if ( p1.getImageableX() != p2.getImageableX() ) { return false; } if ( p1.getImageableY() != p2.getImageableY() ) { return false; } if ( p1.getImageableWidth() != p2.getImageableWidth() ) { return false; } if ( p1.getImageableHeight() != p2.getImageableHeight() ) { return false; } return true; }
Example 3
Source File: PSPrinterJob.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
protected double getPhysicalPrintableHeight(Paper p) { return p.getImageableHeight(); }
Example 4
Source File: RasterPrinterJob.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * updates a Paper object to reflect the current printer's selected * paper size and imageable area for that paper size. * Default implementation copies settings from the original, applies * applies some validity checks, changes them only if they are * clearly unreasonable, then sets them into the new Paper. * Subclasses are expected to override this method to make more * informed decisons. */ protected void validatePaper(Paper origPaper, Paper newPaper) { if (origPaper == null || newPaper == null) { return; } else { double wid = origPaper.getWidth(); double hgt = origPaper.getHeight(); double ix = origPaper.getImageableX(); double iy = origPaper.getImageableY(); double iw = origPaper.getImageableWidth(); double ih = origPaper.getImageableHeight(); /* Assume any +ve values are legal. Overall paper dimensions * take precedence. Make sure imageable area fits on the paper. */ Paper defaultPaper = new Paper(); wid = ((wid > 0.0) ? wid : defaultPaper.getWidth()); hgt = ((hgt > 0.0) ? hgt : defaultPaper.getHeight()); ix = ((ix > 0.0) ? ix : defaultPaper.getImageableX()); iy = ((iy > 0.0) ? iy : defaultPaper.getImageableY()); iw = ((iw > 0.0) ? iw : defaultPaper.getImageableWidth()); ih = ((ih > 0.0) ? ih : defaultPaper.getImageableHeight()); /* full width/height is not likely to be imageable, but since we * don't know the limits we have to allow it */ if (iw > wid) { iw = wid; } if (ih > hgt) { ih = hgt; } if ((ix + iw) > wid) { ix = wid - iw; } if ((iy + ih) > hgt) { iy = hgt - ih; } newPaper.setSize(wid, hgt); newPaper.setImageableArea(ix, iy, iw, ih); } }
Example 5
Source File: PSPrinterJob.java From hottub with GNU General Public License v2.0 | 4 votes |
protected double getPhysicalPrintableHeight(Paper p) { return p.getImageableHeight(); }
Example 6
Source File: RasterPrinterJob.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * updates a Paper object to reflect the current printer's selected * paper size and imageable area for that paper size. * Default implementation copies settings from the original, applies * applies some validity checks, changes them only if they are * clearly unreasonable, then sets them into the new Paper. * Subclasses are expected to override this method to make more * informed decisons. */ protected void validatePaper(Paper origPaper, Paper newPaper) { if (origPaper == null || newPaper == null) { return; } else { double wid = origPaper.getWidth(); double hgt = origPaper.getHeight(); double ix = origPaper.getImageableX(); double iy = origPaper.getImageableY(); double iw = origPaper.getImageableWidth(); double ih = origPaper.getImageableHeight(); /* Assume any +ve values are legal. Overall paper dimensions * take precedence. Make sure imageable area fits on the paper. */ Paper defaultPaper = new Paper(); wid = ((wid > 0.0) ? wid : defaultPaper.getWidth()); hgt = ((hgt > 0.0) ? hgt : defaultPaper.getHeight()); ix = ((ix > 0.0) ? ix : defaultPaper.getImageableX()); iy = ((iy > 0.0) ? iy : defaultPaper.getImageableY()); iw = ((iw > 0.0) ? iw : defaultPaper.getImageableWidth()); ih = ((ih > 0.0) ? ih : defaultPaper.getImageableHeight()); /* full width/height is not likely to be imageable, but since we * don't know the limits we have to allow it */ if (iw > wid) { iw = wid; } if (ih > hgt) { ih = hgt; } if ((ix + iw) > wid) { ix = wid - iw; } if ((iy + ih) > hgt) { iy = hgt - ih; } newPaper.setSize(wid, hgt); newPaper.setImageableArea(ix, iy, iw, ih); } }
Example 7
Source File: PSPrinterJob.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
protected double getPhysicalPrintableHeight(Paper p) { return p.getImageableHeight(); }
Example 8
Source File: PSPrinterJob.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
protected double getPhysicalPrintableHeight(Paper p) { return p.getImageableHeight(); }
Example 9
Source File: RasterPrinterJob.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * updates a Paper object to reflect the current printer's selected * paper size and imageable area for that paper size. * Default implementation copies settings from the original, applies * applies some validity checks, changes them only if they are * clearly unreasonable, then sets them into the new Paper. * Subclasses are expected to override this method to make more * informed decisons. */ protected void validatePaper(Paper origPaper, Paper newPaper) { if (origPaper == null || newPaper == null) { return; } else { double wid = origPaper.getWidth(); double hgt = origPaper.getHeight(); double ix = origPaper.getImageableX(); double iy = origPaper.getImageableY(); double iw = origPaper.getImageableWidth(); double ih = origPaper.getImageableHeight(); /* Assume any +ve values are legal. Overall paper dimensions * take precedence. Make sure imageable area fits on the paper. */ Paper defaultPaper = new Paper(); wid = ((wid > 0.0) ? wid : defaultPaper.getWidth()); hgt = ((hgt > 0.0) ? hgt : defaultPaper.getHeight()); ix = ((ix > 0.0) ? ix : defaultPaper.getImageableX()); iy = ((iy > 0.0) ? iy : defaultPaper.getImageableY()); iw = ((iw > 0.0) ? iw : defaultPaper.getImageableWidth()); ih = ((ih > 0.0) ? ih : defaultPaper.getImageableHeight()); /* full width/height is not likely to be imageable, but since we * don't know the limits we have to allow it */ if (iw > wid) { iw = wid; } if (ih > hgt) { ih = hgt; } if ((ix + iw) > wid) { ix = wid - iw; } if ((iy + ih) > hgt) { iy = hgt - ih; } newPaper.setSize(wid, hgt); newPaper.setImageableArea(ix, iy, iw, ih); } }
Example 10
Source File: PSPrinterJob.java From Bytecoder with Apache License 2.0 | 4 votes |
protected double getPhysicalPrintableHeight(Paper p) { return p.getImageableHeight(); }
Example 11
Source File: RasterPrinterJob.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * updates a Paper object to reflect the current printer's selected * paper size and imageable area for that paper size. * Default implementation copies settings from the original, applies * applies some validity checks, changes them only if they are * clearly unreasonable, then sets them into the new Paper. * Subclasses are expected to override this method to make more * informed decisons. */ protected void validatePaper(Paper origPaper, Paper newPaper) { if (origPaper == null || newPaper == null) { return; } else { double wid = origPaper.getWidth(); double hgt = origPaper.getHeight(); double ix = origPaper.getImageableX(); double iy = origPaper.getImageableY(); double iw = origPaper.getImageableWidth(); double ih = origPaper.getImageableHeight(); /* Assume any +ve values are legal. Overall paper dimensions * take precedence. Make sure imageable area fits on the paper. */ Paper defaultPaper = new Paper(); wid = ((wid > 0.0) ? wid : defaultPaper.getWidth()); hgt = ((hgt > 0.0) ? hgt : defaultPaper.getHeight()); ix = ((ix > 0.0) ? ix : defaultPaper.getImageableX()); iy = ((iy > 0.0) ? iy : defaultPaper.getImageableY()); iw = ((iw > 0.0) ? iw : defaultPaper.getImageableWidth()); ih = ((ih > 0.0) ? ih : defaultPaper.getImageableHeight()); /* full width/height is not likely to be imageable, but since we * don't know the limits we have to allow it */ if (iw > wid) { iw = wid; } if (ih > hgt) { ih = hgt; } if ((ix + iw) > wid) { ix = wid - iw; } if ((iy + ih) > hgt) { iy = hgt - ih; } newPaper.setSize(wid, hgt); newPaper.setImageableArea(ix, iy, iw, ih); } }
Example 12
Source File: RasterPrinterJob.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * updates a Paper object to reflect the current printer's selected * paper size and imageable area for that paper size. * Default implementation copies settings from the original, applies * applies some validity checks, changes them only if they are * clearly unreasonable, then sets them into the new Paper. * Subclasses are expected to override this method to make more * informed decisons. */ protected void validatePaper(Paper origPaper, Paper newPaper) { if (origPaper == null || newPaper == null) { return; } else { double wid = origPaper.getWidth(); double hgt = origPaper.getHeight(); double ix = origPaper.getImageableX(); double iy = origPaper.getImageableY(); double iw = origPaper.getImageableWidth(); double ih = origPaper.getImageableHeight(); /* Assume any +ve values are legal. Overall paper dimensions * take precedence. Make sure imageable area fits on the paper. */ Paper defaultPaper = new Paper(); wid = ((wid > 0.0) ? wid : defaultPaper.getWidth()); hgt = ((hgt > 0.0) ? hgt : defaultPaper.getHeight()); ix = ((ix > 0.0) ? ix : defaultPaper.getImageableX()); iy = ((iy > 0.0) ? iy : defaultPaper.getImageableY()); iw = ((iw > 0.0) ? iw : defaultPaper.getImageableWidth()); ih = ((ih > 0.0) ? ih : defaultPaper.getImageableHeight()); /* full width/height is not likely to be imageable, but since we * don't know the limits we have to allow it */ if (iw > wid) { iw = wid; } if (ih > hgt) { ih = hgt; } if ((ix + iw) > wid) { ix = wid - iw; } if ((iy + ih) > hgt) { iy = hgt - ih; } newPaper.setSize(wid, hgt); newPaper.setImageableArea(ix, iy, iw, ih); } }
Example 13
Source File: PSPrinterJob.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
protected double getPhysicalPrintableHeight(Paper p) { return p.getImageableHeight(); }
Example 14
Source File: PSPrinterJob.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
protected double getPhysicalPrintableHeight(Paper p) { return p.getImageableHeight(); }
Example 15
Source File: RasterPrinterJob.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * updates a Paper object to reflect the current printer's selected * paper size and imageable area for that paper size. * Default implementation copies settings from the original, applies * applies some validity checks, changes them only if they are * clearly unreasonable, then sets them into the new Paper. * Subclasses are expected to override this method to make more * informed decisons. */ protected void validatePaper(Paper origPaper, Paper newPaper) { if (origPaper == null || newPaper == null) { return; } else { double wid = origPaper.getWidth(); double hgt = origPaper.getHeight(); double ix = origPaper.getImageableX(); double iy = origPaper.getImageableY(); double iw = origPaper.getImageableWidth(); double ih = origPaper.getImageableHeight(); /* Assume any +ve values are legal. Overall paper dimensions * take precedence. Make sure imageable area fits on the paper. */ Paper defaultPaper = new Paper(); wid = ((wid > 0.0) ? wid : defaultPaper.getWidth()); hgt = ((hgt > 0.0) ? hgt : defaultPaper.getHeight()); ix = ((ix > 0.0) ? ix : defaultPaper.getImageableX()); iy = ((iy > 0.0) ? iy : defaultPaper.getImageableY()); iw = ((iw > 0.0) ? iw : defaultPaper.getImageableWidth()); ih = ((ih > 0.0) ? ih : defaultPaper.getImageableHeight()); /* full width/height is not likely to be imageable, but since we * don't know the limits we have to allow it */ if (iw > wid) { iw = wid; } if (ih > hgt) { ih = hgt; } if ((ix + iw) > wid) { ix = wid - iw; } if ((iy + ih) > hgt) { iy = hgt - ih; } newPaper.setSize(wid, hgt); newPaper.setImageableArea(ix, iy, iw, ih); } }
Example 16
Source File: RasterPrinterJob.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * updates a Paper object to reflect the current printer's selected * paper size and imageable area for that paper size. * Default implementation copies settings from the original, applies * applies some validity checks, changes them only if they are * clearly unreasonable, then sets them into the new Paper. * Subclasses are expected to override this method to make more * informed decisons. */ protected void validatePaper(Paper origPaper, Paper newPaper) { if (origPaper == null || newPaper == null) { return; } else { double wid = origPaper.getWidth(); double hgt = origPaper.getHeight(); double ix = origPaper.getImageableX(); double iy = origPaper.getImageableY(); double iw = origPaper.getImageableWidth(); double ih = origPaper.getImageableHeight(); /* Assume any +ve values are legal. Overall paper dimensions * take precedence. Make sure imageable area fits on the paper. */ Paper defaultPaper = new Paper(); wid = ((wid > 0.0) ? wid : defaultPaper.getWidth()); hgt = ((hgt > 0.0) ? hgt : defaultPaper.getHeight()); ix = ((ix > 0.0) ? ix : defaultPaper.getImageableX()); iy = ((iy > 0.0) ? iy : defaultPaper.getImageableY()); iw = ((iw > 0.0) ? iw : defaultPaper.getImageableWidth()); ih = ((ih > 0.0) ? ih : defaultPaper.getImageableHeight()); /* full width/height is not likely to be imageable, but since we * don't know the limits we have to allow it */ if (iw > wid) { iw = wid; } if (ih > hgt) { ih = hgt; } if ((ix + iw) > wid) { ix = wid - iw; } if ((iy + ih) > hgt) { iy = hgt - ih; } newPaper.setSize(wid, hgt); newPaper.setImageableArea(ix, iy, iw, ih); } }
Example 17
Source File: PSPrinterJob.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
protected double getPhysicalPrintableHeight(Paper p) { return p.getImageableHeight(); }
Example 18
Source File: PSPrinterJob.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
protected double getPhysicalPrintableHeight(Paper p) { return p.getImageableHeight(); }
Example 19
Source File: StyleFileWriter.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 2 votes |
/** * Returns the borders for the given paper. * * @param p * the paper. * @return The borders. */ private static Insets getBorders( final Paper p ) { return new Insets( (int) p.getImageableY(), (int) p.getImageableX(), (int) ( p.getHeight() - ( p.getImageableY() + p.getImageableHeight() ) ), (int) ( p.getWidth() - ( p .getImageableX() + p.getImageableWidth() ) ) ); }
Example 20
Source File: PageFormatFactory.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 2 votes |
/** * Returns the bottom border of the given paper. * * @param p * the paper that defines the borders. * @return the bottom border. */ public double getBottomBorder( final Paper p ) { return p.getHeight() - ( p.getImageableY() + p.getImageableHeight() ); }