Article View: borland.public.jbuilder.java.language
Article #15539Help printing problem i 1.1.8
From: Oliver Horlacher
Date: Sun, 06 Jun 1999 00:00
Date: Sun, 06 Jun 1999 00:00
65 lines
3174 bytes
3174 bytes
I have a problem with printing the contents (a JChart) to a laser
printer. The printer is a panasonic KX-P7200. Now the reason I
specify the printer is that if I print to an epsom sylus color 600 it
prints just fine!! When printing to the panasonic the program hangs
when I call printAll() on the chart. I have tried to call printAll() on
the frame and it dose not work either. The offending code is the
following.
/** This method gets the graphics from the print job, resizes the graph
to fit onto
the page, and sends the graph to the printer.
*/
public void print(PrintJob job) {
System.out.println("In method print");
Graphics page = job.getGraphics();
System.out.println("Got the graphics object");
Dimension pagesize = job.getPageDimension();
System.out.println("Got job dimentions");
chart.setSize(pagesize.width, pagesize.height);
System.out.println("Set the size");
chart.printAll(page); // This is where it hangs. If I remove this
line I can get the right number of
// blank pages.
System.out.println("chart.printAll");
page.dispose(); // End the page--send it to the printer.
System.out.println("Printed the chart");
}
/** There are 13 graphs for every member and this method cycles
through all of
the graphs and sends them to the print method.
*/
public void setPrint(){
Toolkit toolkit = this.getToolkit();
PrintJob job = toolkit.getPrintJob(this, "Graphs", printprefs);
System.out.println("Got print job");
Dimension size = this.getSize(); // remember the size;
if (job == null)
return;
// print the first two graphs
resetPChart(0, astrMembers[0]);
print(job);
resetPChart(1, astrMembers[0]);
print(job);
// print one of the remaning graphs for every member
for (int x = 2; x < 14; x++) {
for (int y = 0; y < astrMembers.length; y++) {
resetPChart(x,astrMembers[y]);
print(job);
}
}
job.end(); // End the print job.
this.setSize(size); // Return the page to its original size
chart.setSize(this.getSize());
resetChart(); // Resets the chart to the original position
}
If anyone could help me with this I would be most grateful as the person
I am writing this for is getting somwhat annoyed at the amonut of
trouble printing is causing.
Thank you for your time.
Olli.
Technical Details
Message-ID:
<3759BC72.489C@xtra.co.nz>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,b364da5985a5fbc0,start X-Google-Attributes: gidf74b3,public From: Oliver Horlacher <horlacher@xtra.co.nz> Subject: Help printing problem i 1.1.8 Date: 1999/06/06 Message-ID: <3759BC72.489C@xtra.co.nz> X-Deja-AN: 486160187 Content-Transfer-Encoding: 7bit Organization: Olli's Think Tank Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Reply-To: horlacher@xtra.co.nz Newsgroups: borland.public.jbuilder.java.language