PrinterJob pj = PrinterJob.getPrinterJob();
PageFormat pf = pj.defaultPage();
Paper paper = new Paper();
double margin = 36; // half inch
paper.setImageableArea(margin, margin,
paper.getWidth() - margin * 2,
paper.getHeight() - margin * 2);
pf.setPaper(paper);
pj.setPrintable(new ManiaPrintable(), pf);
if (pj.printDialog()) {
try { pj.print(); }
catch (PrinterException e) {
System.out.println(e);
}
}