Display the Page Format Dialog in Java

Description

The following code shows how to display the Page Format Dialog.

Example


//from  w  ww. j a  va 2 s  . c om
import java.awt.print.PageFormat;
import java.awt.print.PrinterJob;

public class Main {
  public static void main(String[] argv) throws Exception {

    PrinterJob pjob = PrinterJob.getPrinterJob();

    PageFormat pf = pjob.defaultPage();
    pf.setOrientation(PageFormat.LANDSCAPE);

    pf = pjob.pageDialog(pf);
  }
}

The code above generates the following result.

Display the Page Format Dialog in Java




















Home »
  Java Tutorial »
    Graphics »




Animation
BufferedImage
Color
Font
Gradient
Graphics Settings
Image
Mouse Draw
Print
Shape
Text
Transform