PrinterJob pj = PrinterJob.getPrinterJob(); pj.setPrintable(new OutlinePrintable()); if (pj.printDialog()) { try { pj.print(); } catch (PrinterException e) { System.out.println(e); } }