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

Banner checkbox in PrinterJob print dialog doesn't work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 5.0
    • client-libs
    • 2d
    • b131
    • x86
    • linux

      FULL PRODUCT VERSION :
      java version "1.5.0_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
      Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux macdonaldjlinux 2.6.11.4-20a-smp #1 SMP Wed Mar 23 21:52:37 UTC 2005 x86_64 x86_64 x86_64 GNU/Linux



      EXTRA RELEVANT SYSTEM CONFIGURATION :
      None -- printer required to test, though

      A DESCRIPTION OF THE PROBLEM :
      Under the "Appearance" tab in the print dialog shown by PrinterJob.getPrinterJob().printDialog(), there is a "Job Attributes" section. Here, there is a "Banner Page" checkbox.

      Selecting this checkbox does not cause a banner page to be printed on a Linux 64-bit machine.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached program on a 64-bit linux machine. Click on the "Appearance" tab. Select the "Banner page" checkbox. Print, and note that no banner is printed.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Expected to get a banner page.
      ACTUAL -
      No banner page.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      //Linux macdonaldjlinux 2.6.11.4-20a-smp #1 SMP Wed Mar 23 21:52:37 UTC 2005 x86_64 x86_64 x86_64 GNU/Linux

      //java version "1.5.0_06"
      //Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
      //Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_06-b05, mixed mode)

      import java.awt.*;
      import java.awt.event.*;
      import java.awt.print.*;
      import javax.swing.*;
      import javax.swing.event.*;

      public class PrintTest
      {
          public static void main(String[] args)
          {
              JFrame frame = new JFrame();
              final JTextArea text = new JTextArea(5, 10);
              frame.getContentPane().add(text);
              frame.getContentPane().add(new JButton(new AbstractAction("Print") {
                      public void actionPerformed(ActionEvent e) {
                          print(text);
                      }
                  }), BorderLayout.SOUTH);
              frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              frame.pack();
              frame.setVisible(true);
          }

          private static void print(final JTextArea text)
          {
              try
              {
                  Printable p = new Printable() {
                          public int print(Graphics g, PageFormat f, int page) {
                              g.drawString("Testing", 100, 100);
                              if (page == 1)
                                  return NO_SUCH_PAGE;
                              return PAGE_EXISTS;
                          }
                      };
                  PrinterJob job = PrinterJob.getPrinterJob();
                  job.setPrintable(p);
                  if (job.printDialog())
                      job.print();
              }
              catch (PrinterException ex)
              {
                  ex.printStackTrace();
              }
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Provide another option to the user with which to print a banner

            psadhukhan Prasanta Sadhukhan
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: