-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
1.2.2
-
None
-
unknown
-
windows_nt
When printing from a Java application a number of pages containing text using drawString, the spooled file is eg. 10/25 Mb for 6 pages. This applies to PCL and postscript printer drivers.
import java.awt.geom.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.print.PrinterJob;
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.awt.print.*;
public class ShapesPrint extends JPanel implements Printable {
public ShapesPrint() {
PrinterJob printJob = PrinterJob.getPrinterJob();
printJob.setPrintable(this);
if (printJob.printDialog()) {
try {
printJob.print();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
public int print(Graphics g, PageFormat pf, int pageIndex) {
if (pageIndex <= 5 )
draw((Graphics2D) g);
if (pageIndex >=6) {
return Printable.NO_SUCH_PAGE;
}
Dimension size = getSize();
return Printable.PAGE_EXISTS;
}
public void draw(Graphics2D g) {
g.setColor(Color.black);
g.drawString("Testing in draw() again again again again again again again", 100, 80);
for(int counter = 100; counter < 700; counter = counter + 10)
g.drawString("Testing in draw() again again again again again again again", 100, counter);
}
public static void main(String s[]){
new ShapesPrint();
}
}
- duplicates
-
JDK-4227245 42 Java2D+Printing Additional~PDL~output for win32
- Resolved