Article View: borland.public.jbuilder.java.swing
Article #9414Printing
From: Michel P�rez
Date: Wed, 12 Apr 2000 00:00
Date: Wed, 12 Apr 2000 00:00
39 lines
1648 bytes
1648 bytes
Greetings !
I'm trying to print, and I need to clear the margins in order to can use the
whole paper, but I can't do it.
How could I do this ?
Here's the code:
public class SimplePrintBook implements Printable {
public static void main(String[] args) { // Obtain a PrinterJob
PrinterJob job = PrinterJob.getPrinterJob(); // Set up a book
Book bk = new Book();
bk.append(new SimplePrintBook(), job.defaultPage(), 1); // Pass the
book to the PrinterJob
job.setPageable(bk); // Put up the dialog box
if (job.printDialog()) {// Print the job if the user didn't cancel
printing
try {
PageFormat pf=job.pageDialog(job.defaultPage());
job.print();
}
catch (Exception e)
{ /* should handle */ }
}
System.exit(0);
}
public int print(Graphics g, PageFormat pf, int pageIndex) throws
PrinterException {
g.setFont(fnt);
g.setColor(Color.green);
g.drawString("Printing",72,100);
return Printable.PAGE_EXISTS;
}
}
Thank for your help !
Technical Details
Message-ID:
<8d1tkn$f3b5@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,8eb97bf69df4e47f,start X-Google-Attributes: gid111d45,public From: "Michel P�rez" <mperez@eurobanco.com> Subject: Printing Date: 2000/04/12 Message-ID: <8d1tkn$f3b5@bornews.borland.com> X-Deja-AN: 610165751 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing