File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes Printing...anybody can help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Printing...anybody can help" Watch "Printing...anybody can help" New topic

Printing...anybody can help

eric mt

Joined: Feb 18, 2001
Posts: 4
I am using jdk1.2.2 for printing,which utilises java.awt.print package,PageFormat and PrinterJob classes with interface Printable.When i run my program in Windows it will take the
page-set-up of windows itself.But i am not able to get multiple copies when i change the values in the option provided with PageSetUp for the same.A part of my code is mentioned below...
here i am doing
PrinterJob pj = PrinterJob.getPrinterJob();
PageFormat pf = pj.pageDialog(pj.defaultPage());
and after
class PrintableClass implements Printable
BufferedImage bi;
public PrintableClass(BufferedImage bim,PageFormat pf) {
bi = bim;
public int print(Graphics g,PageFormat pf,int pageIndex) {
if(pageIndex != 0) return NO_SUCH_PAGE;
Graphics2D g2 = (Graphics2D)g;

somebody can help.....
Thanks in advance...Eric
I agree. Here's the link:
subject: Printing...anybody can help
jQuery in Action, 3rd edition