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

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

    XMLWordPrintable

    Details

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

      Description

      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 ---------------------------------------------------
            try
            {
               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
                  g.dispose();

                  job.end();

               }
               PrivilegeManager.revertPrivilege("UniversalPrintJobAccess");
            }

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



      // multiList.printAll

      public void printAll(Graphics g)
         {
          /*

      g.drawImage(offscreenImage.getScaledInstance(offscreenImage.getWidth(this),

      offscreenImage.getHeight(this),Image.SCALE_SMOOTH),0,0,Color.white,this);
          */

      g.drawImage(offscreenImage.getScaledInstance(offscreenImage.getWidth(this),
             offscreenImage.getHeight(this),Image.SCALE_DEFAULT),5,5,this);

         }


      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()
         {
             super("PrintGraphics");
             img = Toolkit.getDefaultToolkit().getImage("C:/image.gif");
             MediaTracker mt = new MediaTracker(this);
             mt.addImage(img, 0);
             try {
                 mt.waitForAll();
             } catch (Exception e) {};
             Button b = new Button( "Print");
             b.setActionCommand("print");
             b.addActionListener(this);
             add("South",b);
             pack();
          }//constructor

          public void actionPerformed(ActionEvent e)
          {
              String cmd = e.getActionCommand();
              if (cmd.equals("print"))
              {
              PrintJob pj =
        Toolkit.getDefaultToolkit().getPrintJob(null,"Title",null);
              Graphics g = pj.getGraphics();
              g.drawImage(img,5,5,null);
              g.dispose();
              pj.end();
              }//if
          }//actionPerformed
          public static void main(String args[])
          {
              PrintGraphics test = new PrintGraphics();
              test.addWindowListener(new WindowCloser());
              test.show();
          }
      }//class PrintGraphics

      class WindowCloser extends WindowAdapter
      {
          public void windowClosing(WindowEvent e)
          {
              Window win = e.getWindow();
              win.setVisible(false);
              win.dispose();
              System.exit(0);
          }//windowClosing
      }//class WindowCloser
      (Review ID: 98296)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            son Oleg Sukhodolsky (Inactive)
            Reporter:
            mhmccart Mary Mccarthy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: