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

Double-sided printing does not work on HP LaserJet 5 SI and Kyocera printer

XMLWordPrintable

    • 2d
    • hopper
    • x86
    • windows_2000


      ###@###.### 2001-11-26

      J2SE Version (please include all output from java -version flag):
        Java 1.3 - any version from 1.3.0 to 1.3.1_01a
        Java 1.4 - all tested version including 1.4 beta3

      Operating System Configuration Information (be specific):
        On any Windows operating system (9x, NT4, 2000)

      Hardware Configuration Information (be specific):
        Works fine on HP Laserjet 4050 TN printer, but fail on Kyocera or
        a HP Laserjet 5 SI printer. Both of them has latest printer driver
        installed.

      Bug Description:

        Having problem to print two-sided forms on a duplex printer. Customers
        use a book for collecting two forms in one printer job and print strings
        inside these forms with Graphics.drawString(). The most printers prints
        two single-sided sheets of paper instead of one sheet printed on both
        sides. Only one printer, a HP Laserjet 4050 TN does the job correct,
        where a Kyocera or a HP Laserjet 5 SI for example does not, though they
        are of course equipped with a duplexing unit and duplexing is enabled in
        the printer driver and in the printer dialog.

        Our first guess was, that they exceeded the imageable area of the printer,
        thus producing a second page occupying the backside of the form, but with
        a test producing just a small text at the center of the form.



      Steps to Reproduce (be specific):

        run attached jar file - java -jar TestDruck.jar J H 1 to reproduce
        the problem.

        Also attached a simplified version of the frame class for printing
        (DruckTest.java).

      Test program(DruckTest.java)
      =============================

      import java.awt.print.*;
      import java.io.PrintStream;
      import javax.swing.JOptionPane;

      public class DruckTest
      {
          public static void main(String args[])
          {
              try
              {
                  boolean lbPrintForm = true;
                  PrinterJob lPrinterCopies = null;
                  PageFormat pform = new PageFormat();
                  Paper paper = pform.getPaper();
                  paper.setSize(595.20000000000005D, 841.79999999999995D);
                  paper.setImageableArea(0.0D, 0.0D, 600D, 900D);
                  pform.setPaper(paper);
                  pform.setOrientation(1);
                  PrinterJob printJob = PrinterJob.getPrinterJob();
                  printJob.setCopies(1);
                  if(printJob.printDialog())
                  {
                      PageFormat pformVal = printJob.validatePage(pform);
                      printForm(printJob, pformVal);
                  }
                  else return;
              }
              catch(Exception e)
              {
                  e.printStackTrace();
              }
          }

          private static boolean printForm(PrinterJob vPrinterJob, PageFormat
      vPageFormat)
          {
              Book bk = new Book();
              UZFormularBedruckenSeite1 lUZFormularBedruckenSeite1 = new
      UZFormularBedruckenSeite1("100", true);
              bk.append(lUZFormularBedruckenSeite1, vPageFormat);
              UZFormularBedruckenSeite2 lUZFormularBedruckenSeite2 = new
      UZFormularBedruckenSeite2("100", true);
              bk.append(lUZFormularBedruckenSeite2, vPageFormat);
              System.out.println("Book:".concat(String.valueOf(bk.getNumberOfPages())));
              System.out.println("Print Job:".concat(String.valueOf(vPrinterJob.toString())));
              vPrinterJob.setPageable(bk);
              try
              {
                  vPrinterJob.print();
                  boolean flag1 = true;
                  return flag1;
              }
              catch(Exception ex)
              {
                  ex.printStackTrace();
              }
          }

          private static PrinterJob mPrinterUZ;
      }

      fixed. verified testcase provided in the bug report through HP Laserjet 5 SI driver, on win2000 with java Java2D:08-Apr-02@04:09. I did not verify with the driver Kyocera, since the bug report did not metion which version to be used to reproduce the bug.

      ###@###.### 2002-04-10

            jgodinez Jennifer Godinez (Inactive)
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: