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

Problems printing from an applet with any print driver newer than an HP4Si



    • Subcomponent:
    • CPU:
      generic, x86
    • OS:
      generic, windows_95


      Printing with certain drivers causes an applet to print only blank pages.
      The following code segment from a client applet will succeed with some
      print drivers and will only print blank pages with others. For example
      an HP5Si print driver to a HP5Si prints blank pages while an HP4Si print
      driver to a HP5Si prints OK.

      ------------ code segment ---------------------------------------------------
               PrintJob job = theFrame.getToolkit().getPrintJob((java.awt.Frame)
      theFrame, "print job", null);
               if (job != null)
                  Graphics g = job.getGraphics();
                  multiListSummary1.printAll(g); // my printAll mod in MultiList



            catch (netscape.security.ForbiddenTargetException ex)
               System.err.println("User did not grant print access");

      // multiList.printAll

      public void printAll(Graphics g)





      Name: krT82822 Date: 09/20/99

      This problem is related to bug id : 4191511

      We have blank pages when printing images (java.awt.image)
      to a HP5SI printer from any browser using the 1.1.2 plug-in.

      If we use raw text (drawString), the text is printed correctly.
      But if we add an image, it is not printed (text is still OK).

      In the text for bug 4191511, it is said that there are
      isssues when using HP5SI drivers. It is recommended to use
      HP4SI drivers.
      We have tried multiple drivers (HP4SI, HP4/4M PS, ...) and
      experienced all sorts of problems.

      What is the exact driver to use for an HP5SI printer ?
      What are the drivers to use with other HP printers ?


      We are using NT 4.0 for our printer server.

      The only way we know to force using POSTSCRIPT is to use a
      Postcript driver so we used the :
      HP Laserjet 4SI MX PS driver.

      The quality of the image was poor and the background was
      dark grey instead of white.

      We also tried the HP Laserjet 5SI MX PS driver and got the
      same result.

      (Review ID: 95470)

      Name: mc57594 Date: 11/27/99

      java PrintGraphics

      My company has an HP LaserJet 4000TN printer.
      My bug is related with the getPrintJob method provided with the Toolkit class.
      Everytime I try to print an image from any kind of Java application (applet,
      AWT application,..) I get a blank page if I select some of the most modern
      drivers for this printer. I have to install the oldest driver (Laserjet 4) to
      print properly the image. Some people with LEXMARK printers have the same
      problem. I include an example but I have the same problem with all this kind of
      applications. I can't force my clients to change their drivers because they are
      too many people. Any ideas? Thank you very much.

      import java.awt.*;
      import java.awt.event.*;

      public class PrintGraphics extends Frame
      implements ActionListener
         Image img;
         public PrintGraphics()
             img = Toolkit.getDefaultToolkit().getImage("C:/image.gif");
             MediaTracker mt = new MediaTracker(this);
             mt.addImage(img, 0);
             try {
             } catch (Exception e) {};
             Button b = new Button( "Print");

          public void actionPerformed(ActionEvent e)
              String cmd = e.getActionCommand();
              if (cmd.equals("print"))
              PrintJob pj =
              Graphics g = pj.getGraphics();
          public static void main(String args[])
              PrintGraphics test = new PrintGraphics();
              test.addWindowListener(new WindowCloser());
      }//class PrintGraphics

      class WindowCloser extends WindowAdapter
          public void windowClosing(WindowEvent e)
              Window win = e.getWindow();
      }//class WindowCloser
      (Review ID: 98296)




            son Oleg Sukhodolsky (Inactive)
            mhmccart Mary Mccarthy
            0 Vote for this issue
            0 Start watching this issue