Print Dialog: change the default printer settings(default printer, number of copies, range of pages)
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();
pjob.setPrintable(null, pf);
if (pjob.printDialog()) {
pjob.print();
}
}
}
Related examples in the same category