-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.3.0
-
x86
-
windows_98
Name: rlT66838 Date: 03/06/2000
java version "1.3.0rc1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)
Printer errors occur when trying to print an image using the java.awt.print
libraries from windows 98 or windows 95 to an "HP LaserJet 4050". Customers have
also reported similar problems with an "HP Photo Smart P1000". The problem has
two manifestations. Text and Shapes can be rendered without problem, however if
Graphics2D.drawImage() is used one of two problems occur. Either the image is
never rendered (leaving a white or black space in its place) or a printer error
page is generated which contains the following text.
PCL XL error
Subsystem: KERNEL
Error: IllegalStreamHeader
Operator: 0x0
Position: 0
Running the same code on windows NT produces the desired "correct" output. We
have tried several other printers wich produce perfect results regardless of
which type of windows is used (Epson stylus color 850, Apple Laserwriter 16/60,
Tektronix phasor 560).
SOURCE CODE:
import java.awt.*;
import java.awt.image.*;
import java.awt.print.*;
import java.io.*;
import javax.swing.*;
public class PrintTester extends JPanel implements Printable{
protected Image img;
public PrintTester(String imagefile){
img = (new ImageIcon(imagefile)).getImage();
PrinterJob printJob = PrinterJob.getPrinterJob();
printJob.setPrintable(this);
if (printJob.printDialog()) {
try {
printJob.print();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) {
if(pageIndex == 0){
graphics.drawImage(img, 72, 72, this);
return PAGE_EXISTS;
}else{
return NO_SUCH_PAGE;
}
}
public static void main(String[] args){
try{
try{
PrintTester pt = new PrintTester(args[0]);
}catch(Exception e){
e.printStackTrace();
}
System.in.read();
}catch(IOException ioe){}
System.exit(0);
}
}
(Review ID: 102058)
======================================================================
- duplicates
-
JDK-4258020 Java 2D printing API : images are B&W on PCL printers on win95/98 only
-
- Closed
-