List of usage examples for javax.print.attribute.standard OrientationRequested REVERSE_LANDSCAPE
OrientationRequested REVERSE_LANDSCAPE
To view the source code for javax.print.attribute.standard OrientationRequested REVERSE_LANDSCAPE.
Click Source Link
From source file:org.pentaho.reporting.engine.classic.extensions.modules.java14print.Java14PrintUtil.java
public static PageFormat extractPageFormat(final PrintRequestAttributeSet attributeSet) { final Media media = (Media) attributeSet.get(Media.class); final MediaPrintableArea printableArea = (MediaPrintableArea) attributeSet.get(MediaPrintableArea.class); final OrientationRequested orientationRequested = (OrientationRequested) attributeSet .get(OrientationRequested.class); final MediaSize mediaSize = lookupMediaSize(media); if (mediaSize == null) { logger.warn("Unknown media encountered, unable to compute page sizes."); }//from w ww.ja v a 2 s . c om final PageFormat pageFormat = new PageFormat(); pageFormat.setPaper(createPaper(mediaSize, printableArea)); if (OrientationRequested.PORTRAIT.equals(orientationRequested)) { pageFormat.setOrientation(PageFormat.PORTRAIT); } else if (OrientationRequested.LANDSCAPE.equals(orientationRequested)) { pageFormat.setOrientation(PageFormat.LANDSCAPE); } else if (OrientationRequested.REVERSE_LANDSCAPE.equals(orientationRequested)) { pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE); } else if (OrientationRequested.REVERSE_PORTRAIT.equals(orientationRequested)) { pageFormat.setOrientation(PageFormat.PORTRAIT); } return pageFormat; }
From source file:org.pentaho.reporting.engine.classic.extensions.modules.java14print.Java14PrintUtil.java
private static OrientationRequested mapOrientation(final int orientation) { switch (orientation) { case PageFormat.LANDSCAPE: return OrientationRequested.LANDSCAPE; case PageFormat.REVERSE_LANDSCAPE: return OrientationRequested.REVERSE_LANDSCAPE; case PageFormat.PORTRAIT: return OrientationRequested.PORTRAIT; default:/* w w w.ja v a 2 s .c o m*/ throw new IllegalArgumentException("The given value is no valid PageFormat orientation."); } }