Displaying the Print Dialog

The print dialog allows the user to change the default printer settings such as the default printer, number of copies, range of pages, etc.
PrinterJob pjob = PrinterJob.getPrinterJob(); PageFormat pf = pjob.defaultPage(); pjob.setPrintable(new PrintableClass(), pf); try { if (pjob.printDialog()) { pjob.print(); } } catch (PrinterException e) { }

Comments

27 Aug 2010 - 12:27pm by Anonymous (not verified)

thanks for z snippet but I've run into some problem with the reference to the 'PrintableClass' my editor is saying that it is undefined. Can you please elaborate a bit more

Post a comment

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.