![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e710. Setting the Orientation of a Print Job -- Portrait or LandscapePrint job attributes are delivered to the print service via the print request attribute set supplied toDocPrintJob.print() . See
e700 The Quintessential Printing Program Using a Printing Service to see how to set up a print job.
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) { }
e712. Printing to a File © 2002 Addison-Wesley. |