-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.2.0
-
generic, x86
-
generic, windows_95, windows_nt
Name: tb29552 Date: 10/30/98
/*
When I print more than a page of text, the
"Progress" column in the print queue box will
show "0 bytes of 900Kb", 2 pages will be
"0 bytes of 1.74Mb", 3 pages will be "4.34Mb"
and so forth. It takes forever just to print
5 pages of text.
This does not occur for JDK1.1.6 (using PrintJob).
Printing 3 pages of text is almost instantaneous.
Progress column will show "0 bytes of 22.5Kb" for
3 pages compared with JDK1.2's 4.34MB.
Sample code:
------------
*/
/* source for Printable implementation */
import java.awt.*;
import java.awt.print.*;
public class Painter implements Printable {
Font textFont = new Font("Monospaced", Font.PLAIN, 10);
public int print(Graphics g, PageFormat pageFormat,
int pageIndex)
throws PrinterException
{
g.setColor(Color.black);
g.setFont(textFont);
FontMetrics fm = g.getFontMetrics();
int x = 72;
int y = 72 + fm.getAscent();
for (int i = 0; i < 40; i++) {
g.drawString("sample line of text", x, y);
y += fm.getHeight();
}
return Printable.PAGE_EXISTS;
}
}
---------------------------------------------
/* source for test stub */
import java.awt.*;
import java.awt.print.*;
public class test {
public test () {
PrinterJob pJ = PrinterJob.getPrinterJob();
Paper A4_paper = new Paper();
A4_paper.setSize(595, 845);
A4_paper.setImageableArea(60, 60, 451, 698);
PageFormat pF = new PageFormat();
pF.setOrientation(PageFormat.PORTRAIT);
pF.setPaper(A4_paper);
Painter painter = new Painter ();
Book book = new Book();
for (int i = 0; i < 5; i++) {
book.append(painter, pF);
}
pJ.setPageable(book);
try {
pJ.print();
} catch(PrinterException pE) {
}
}
public static void main(String args[]) {
test newPrintJob = new test ();
}
}
/*
Note: Printing was done on HP LaserJet 4V.
*/
(Review ID: 41670)
======================================================================
- duplicates
-
JDK-4227245 42 Java2D+Printing Additional~PDL~output for win32
- Resolved
- relates to
-
JDK-4185668 Huge print files generated by jdk1.2 rc1
- Closed
-
JDK-4229795 Printable.print(...) called 100s of times leading to HUGE print jobs
- Closed
-
JDK-4186111 AWT Print engine calls print() twice with same page, ignoring first rendering
- Closed