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

[macosx] Print job goes to default printer regardless of chosen printer

    XMLWordPrintable

Details

    • 2d
    • b102
    • os_x

    Description

      FULL PRODUCT VERSION :
      java version " 1.7.0_21 "
      Java (TM) SE Runtime Environment (build 1.7.0_21-b12)
      Java HotSpot (TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Darwin Mathiass-Mac-mini.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      This problem affects only systems with more than one printer.

      On the test-system, there is three printers:

      CUPS_PDF (default printer)
      Samsung_CLP_610
      Zebra_TLP2844_2

      Regardless of which printer is selected, the print job is sent to the default printer. Debugging confirms that the correct printer is selected.

      Read more on: https://forums.oracle.com/message/10525364


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.print.PrintService;
      import javax.print.PrintServiceLookup;
      import java.awt.print.PrinterJob;


      public class PrintBug {
      public static PrintService getPrintServiceByName( String printerName ) {
      PrintService[] services = PrintServiceLookup.lookupPrintServices( null, null );

      for( PrintService service : services ) {
      if( service.getName().compareToIgnoreCase( printerName ) == 0 )
      return service;
      }

      return null;
      }


      public static void main( String[] args ) throws Exception {
      PrinterJob printJob = PrinterJob.getPrinterJob();

      /* Code to add some content to print */

      printJob.setPrintService( getPrintServiceByName( " MyPrinter " ) );
      printJob.print();
      }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Set the default printer on the OS to the printer you wish to use

      Attachments

        Issue Links

          Activity

            People

              jgodinez Jennifer Godinez (Inactive)
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: