Setting the Orientation of a Print Job -- Portrait or Landscape - Java 2D Graphics

Java examples for 2D Graphics:Print

Description

Setting the Orientation of a Print Job -- Portrait or Landscape

try {
    // Set up the attribute set
    PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
    if (portrait) {
        aset.add(OrientationRequested.PORTRAIT);
    } else {
        aset.add(OrientationRequested.LANDSCAPE);
    }

    // Print it
    job.print(doc, aset);
} catch (PrintException e) {
}

Related Tutorials