0 Replies Latest reply: Mar 29, 2013 12:53 PM by 1000017 RSS

    MAC 10.7.5  with Java 1.7.0 Update 17  Print not working

    1000017
      I was wondering if anyone else has had this problem.

      Here's information and a simple program to try. Any help is appreciated.

      my email is: < removed by moderator so that you won't get spammed for all Eternity >

      thanks!!!
      ---------------------------------------------------------------------------------------------------------------------------

      SYNOPSIS
      --------
      Printed hard copy reports are "messed" up. Application prints using a single font/single size when application actually
      is programmed to use several font types with various sizes.

      OPERATING SYSTEM(S)
      -------------------
      This problem is platform specific MAC OS X running Java 1.7.

      Print error occurs with this OS and java version.
      Mac OS X 10.7.5
      Java 1.7.0 Update 17 (build 1.7.0_17-b02) Also fails on 1.7.0 Update 15.

      Note: Print works with this OS and java version
      Mac OS X 10.6.8
      Java 1.6.0_43-b01-447


      FULL JDK VERSION(S)
      -------------------
      As above Java 1.7.0 Update 17 (build 1.7.0_17-b02)
      This problem occurs in with the latest JRE.

      PROBLEM DESCRIPTION
      -------------------
      This is a print "font" problem". We have very simple print program (Attached) using different font sizes, the hard copy print will use a single font in one size, ignoring the fonts the app is programmed to use.

      Problem happens every time. If you take 2 classes attached and build a signed applet, you will see the problem.
      This is a problem only in the MAC os enviroment 10.7.5 using Java 1.7 (see above). Earlier versions work fine.
      Note: Other printed information like lines and bar codes are correct.
      Note: Java console show no errors.

      TEST CASE
      --------
      Attach 2 classes will show problem.

      REPRODUCTION INSTRUCTIONS
      -------------------------
      Run a signed applet with the 2 sample print classes.

      WORK AROUND
      ----------
      No work around.

      SUGGESTED FIX
      -------------
      None

      ----------------------------------- SAMPLE PROGRAM -----------------------------------------------------------

      SimplePrint.java

      import java.applet.*;
      import java.awt.print.*;

      public class SimplePrint extends Applet
      {
      public void start()
      {
      PrinterJob pj=PrinterJob.getPrinterJob();
      pj.setPrintable(new PrintTest());

      if(pj.printDialog())
      {
      try
      {
      pj.print();
      }
      catch(PrinterException e)
      {
      System.out.println(e);
      }
      }
      }
      } // end of class
      ---------------------------------------------------------------
      PrintTest.java

      import java.awt.print.*;
      import java.awt.*;
      public class PrintTest implements Printable
      {
      public int print(Graphics g,PageFormat pf,int pageIndex)
      {
      if(pageIndex!=0)
      {
      return NO_SUCH_PAGE;
      }
      Graphics2D g2=(Graphics2D)g;
      int y=100;
      float size;
      Font sf=g2.getFont();
      for(int i=0;i<10;++i)
      {
      g2.drawString("Hello 1111 world! Java Source and Support",100,y);
      size=sf.getSize2D();
      size+=2;
      sf=sf.deriveFont(size);
      System.out.println("font name="+sf.getName()+" size="+sf.getSize());
      g2.setFont(sf);
      y+=30;
      }
      return PAGE_EXISTS;
      }
      }
      -----------------------------------------
      HTML Page to launch after create a signed jar

      Print.html
      -------------------

      <html>
      <head>
      <title>Simple Print- MAC 10.7.5</title>
      </head>
      <body>
      <APPLET mayscript code="SimplePrint.class" align="baseline" width="0" height="0">
      <param name="archive" value="exc.jar">
      </APPLET>
      </body>
      </html>