JDK-4357496 : JPEG and GIF images be printed incompletely in Windows95/98.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.3.0
  • Priority: P5
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_95
  • CPU: x86
  • Submitted: 2000-07-28
  • Updated: 2000-11-15
  • Resolved: 2000-11-15
Related Reports
Duplicate :  
Description

Name: el35337			Date: 07/28/2000


When we attempt to print JPEG and GIF images in Windows95 or
Windows98, the printed images become incomplete.
There are two big problems.
One is that the outline of letters(of the image) and curve lines
becomes jagged.
Another is that every image is printed two-tone(Black&White)
with no greyscaling.

The following is the test programs.
But I can't send JPEG and GIF images.Please have JPEG or GIF
image ready for this test.
(This test program is Applet.)

1. Applet program
--------------------------------------------------------------
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;

public class Test extends JApplet
{
	private Container pane;
	private JButton btn;
	private Image img;
	private Canv canv;

	public void init(){

		img = getImage(getDocumentBase(),"xxxxx.jpg"); //input JPG or GIF file name

		pane = getContentPane();
		pane.setLayout(new BorderLayout());

		btn = new JButton("Print");
		canv = new Canv(img);

		pane.add(btn,BorderLayout.NORTH);
		pane.add(canv,BorderLayout.CENTER);
		
		btn.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent evt){
				PrinterJob pj = PrinterJob.getPrinterJob();
				pj.setPrintable((Printable)canv);

				if(pj.printDialog()){
					try{
						pj.print();
					}catch(PrinterException pe){
						System.out.println(pe);
					}
				}
			}
		});
	}
}

class Canv extends Canvas implements Printable
{
	Image img;

	Canv(Image img){
		this.img = img;
	}

	public void paint(Graphics g){
		g.drawImage(img,5,5,this);
	}

	/**
	 *
	 *	Interface Printable   print Method
	 */
	public int print(Graphics g,PageFormat pf,int pageIndex)
	{
		if(pageIndex != 0){
			return NO_SUCH_PAGE;
		}

		//Graphics2D Cast
		Graphics2D g2 = (Graphics2D)g;

		//public abstract void translate(int x,int y)
		//Graphics2D
		g2.translate(pf.getImageableX(),pf.getImageableY());

		//g2 print
		paint(g2);
		return PAGE_EXISTS;
	}
}  
-------------------------------------------------------------------

2. HTML program
--------------------------------------------------------------------
<HTML>
<BODY>
<!--"CONVERTED_APPLET"-->
<!-- CONVERTER VERSION 1.0 -->
<CENTER>
<BR>
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = 500 HEIGHT = 300  codebase=
"http://java.sun.com/products/plugin/1.2/jinstall-12-win32.cab#Version=1,2,0,0">
<PARAM NAME = CODE VALUE = "DialogFromDayButton.class" >

<PARAM NAME="type" VALUE="application/x-java-applet;version=1.2">
<COMMENT>
<EMBED type="application/x-java-applet;version=1.2" CODE = "Test.class"
WIDTH = 500 HEIGHT = 300   pluginspage=
"http://java.sun.com/products/plugin/1.2/plugin-install.html"><NOEMBED></COMMENT>

</NOEMBED></EMBED>
</OBJECT>
<CENTER>

<!--
<APPLET  CODE = "DialogFromButton.class" WIDTH = 500 HEIGHT = 400 >


</APPLET>
--------------------------------------------------------------------
(Review ID: 106820) 
======================================================================

Comments
EVALUATION >There are two big problems. >One is that the outline of letters(of the image) and curve lines >becomes jagged. What lines and letters? The example doesn't demonstrate this. But perhaps the same as bug 4300123? >Another is that every image is printed two-tone(Black&White) >with no greyscaling. I also note that the test case is buggy: it makes no attempt to esnure the image is loaded. Is a PCL printer being used? If so this is a DUP of 4258020. phil.race@eng 2000-07-28 ========================
28-07-2000