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

Java printing messed up on Mac OSX

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 7u17
    • deploy

      FULL PRODUCT VERSION :
      Mac OS X 10.7.5 running Java 1.7.0_17-b02

      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X 10.7.5 (1136Gb)

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Mac Book Air

      A DESCRIPTION OF THE PROBLEM :
      Mac OS X 10.7.5 running Java 1.7.0_17-b02 (also same problem with _15). Print works fine on MAC 10.6 with Java 1.6 and earlier.
      We run a worldwide java applet application for 300+ corporation (thousands of users) since 1998. With new mac os/java version, our print programs print a mess. The problem is changing fonts is not working, e.g setting size, color, and font type are ignore. However drawLine drawRect are still working. It has to do with Fonts. See simple program below -- to show problem.

      REGRESSION. Last worked in version 6u31

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Build a signed applet below from 2 simple classes. Print report and you'll see what I mean.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Print report are same as Windows and prior Mac versions
      ACTUAL -
      Report print with one large font. text overlays other text - reports are unusable

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      I check Java console - not errors are found.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      See code below -- I can also send you the Sign Jar file and html to run the applet. Also pdf file of what hte actual print looks like.

      Create a signed applet

      2 classes - Applet and print classes
      =============================================
      package exc.fe;
      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
      =============================================
      Print class
      package exc.fe;
      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;
        }
      }

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

      SUPPORT :
      YES

            ddehaven David Dehaven (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: