Java examples for 2D Graphics:Print
Setting the Orientation of a Printed Page
import java.awt.print.PageFormat; import java.awt.print.Printable; import java.awt.print.PrinterException; import java.awt.print.PrinterJob; public class Main { public static void main(String[] args) { PrinterJob pjob = PrinterJob.getPrinterJob(); PageFormat pf = pjob.defaultPage(); pf.setOrientation(PageFormat.PORTRAIT); pf.setOrientation(PageFormat.LANDSCAPE); Printable printable = null;/* w ww .j a va2s .co m*/ pjob.setPrintable(printable, pf); try { pjob.print(); } catch (PrinterException e) { } } }