-
Bug
-
Resolution: Fixed
-
P4
-
1.4.0
-
rc1
-
x86
-
windows_95
-
Verified
Printing of multiple pages using the java.awt API does not work. Although the JobAttributes.setCopies() method is used to set the number of copies to be greater than 1, the number of copies actually printed is just 1. This is despite the fact that the number of copies that the print dialog shows is more than 1. Also, when the number of copies is manually increased in the print dialog, the number of copies printed is still 1. This is happening in Win32 as well as Solaris platforms on merlin build 82. This can be seen in the following application :
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
public class MultiplePrinting implements ActionListener{
final Frame TstFrm = new Frame("Test Frame");
Button PrnBtn = new Button("Print");
public static void main(String []args){
MultiplePrinting Mtp = new MultiplePrinting();
}
public MultiplePrinting(){
TstFrm.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent we){
TstFrm.dispose();
}
});
PrnBtn.addActionListener(this);
TstFrm.add(PrnBtn,BorderLayout.SOUTH);
TstFrm.setSize(100,100);
TstFrm.setVisible(true);
}
public void actionPerformed(ActionEvent ae){
JobAttributes JbAtrb = new JobAttributes();
JbAtrb.setCopies(2);
JbAtrb.setDialog(JobAttributes.DialogType.NATIVE);
PrintJob PJ = Toolkit.getDefaultToolkit().getPrintJob(
TstFrm,"Testing Multiple", JbAtrb,null);
if (PJ != null){
Graphics G = PJ.getGraphics();
if (G != null){
G.setFont(new Font("Dialog", Font.BOLD, 16));
G.setColor(Color.green);
G.drawString("Page 1" , 100, 40);
}
G.dispose();
}
PJ.end();
}
}
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
public class MultiplePrinting implements ActionListener{
final Frame TstFrm = new Frame("Test Frame");
Button PrnBtn = new Button("Print");
public static void main(String []args){
MultiplePrinting Mtp = new MultiplePrinting();
}
public MultiplePrinting(){
TstFrm.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent we){
TstFrm.dispose();
}
});
PrnBtn.addActionListener(this);
TstFrm.add(PrnBtn,BorderLayout.SOUTH);
TstFrm.setSize(100,100);
TstFrm.setVisible(true);
}
public void actionPerformed(ActionEvent ae){
JobAttributes JbAtrb = new JobAttributes();
JbAtrb.setCopies(2);
JbAtrb.setDialog(JobAttributes.DialogType.NATIVE);
PrintJob PJ = Toolkit.getDefaultToolkit().getPrintJob(
TstFrm,"Testing Multiple", JbAtrb,null);
if (PJ != null){
Graphics G = PJ.getGraphics();
if (G != null){
G.setFont(new Font("Dialog", Font.BOLD, 16));
G.setColor(Color.green);
G.drawString("Page 1" , 100, 40);
}
G.dispose();
}
PJ.end();
}
}