Example usage for javax.print.attribute.standard OrientationRequested REVERSE_PORTRAIT

List of usage examples for javax.print.attribute.standard OrientationRequested REVERSE_PORTRAIT

Introduction

In this page you can find the example usage for javax.print.attribute.standard OrientationRequested REVERSE_PORTRAIT.

Prototype

OrientationRequested REVERSE_PORTRAIT

To view the source code for javax.print.attribute.standard OrientationRequested REVERSE_PORTRAIT.

Click Source Link

Document

The content will be imaged across the short edge of the medium, but in the opposite manner from portrait.

Usage

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 w  w  . j  ava 2s . co m*/

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