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

PrinterJob's printDialog method not working in macOS 10.15 Beta

XMLWordPrintable

    • x86
    • os_x

      ADDITIONAL SYSTEM INFORMATION :
      macOS 10.5 Catalina Beta

      A DESCRIPTION OF THE PROBLEM :
      Trying to open AWT's print dialog in macOS 10.15 Catalina shows a very similar error that the one in JDK-8227836:

      2019-08-12 18:30:55.588 java[24288:410470] +[NSXPCSharedListener endpointForReply:withListenerName:]: an error occurred while attempting to obtain endpoint for listener 'com.apple.view-bridge': Connection interrupted
      2019-08-12 18:30:55.588 java[24288:410388] *** Assertion failure in -[RemotePDEHost loadRemotePDEHost], /BuildRoot/Library/Caches/com.apple.xbs/Sources/PrintingPlugins/PrintingPlugins-607/PrintCocoaUI/RemotePDEHost.mm:546

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The print dialog should open without any error.
      ACTUAL -
      2 errors are printed before the dialog is opened.

      ---------- BEGIN SOURCE ----------
      import java.awt.Graphics;
      import java.awt.print.PageFormat;
      import java.awt.print.Printable;
      import java.awt.print.PrinterException;
      import java.awt.print.PrinterJob;

      public class PrintTest implements Printable {
        public int print(Graphics g, PageFormat pf, int pageIndex) {
          g.drawString("Some text in the page.", 144, 144);
          return PAGE_EXISTS;
        }

        public static void main(String[] args) {
          PrinterJob pj = PrinterJob.getPrinterJob();
          pj.setPrintable(new PrintTest());
          if (pj.printDialog()) {
            try {
              pj.print();
            } catch (PrinterException e) {
              System.out.println(e);
            }
          }
        }
      }
      ---------- END SOURCE ----------

            pardesha Pardeep Sharma
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: