List of usage examples for javax.print.attribute PrintRequestAttributeSet get
public Attribute get(Class<?> category);
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 ww w . j a va 2s. com 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; }