Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4515055

multiple copies not printed using the java.awt API in JDK1.4

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.4.0
    • client-libs
    • 2d
    • 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();
              }

      }

            jgodinez Jennifer Godinez (Inactive)
            kjethisunw Kanishk Jethi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: