3 Replies Latest reply: Sep 20, 2011 1:38 PM by 809490 RSS

    printing PDF on Macintosh


      I have an application, which has to write PDF files using java.awt.print.Printable and which works fine on Windows clients.
      Now I want to do the same on Macintosh, but I just get a dialog with "Keine Druckdienste gefunden", which means "No printservices available".

      The class looks like this
      public class Fax2 implements Printable
           public int print(Graphics g, PageFormat pf, int pi)
                     throws PrinterException 
                      Graphics2D  g2 = (Graphics2D) g;
                      g2.drawLine(175, 170, 600, 170);
      and it gets called like this
                              Fax2 fax = new Fax2();
                     PrinterJob printjob = PrinterJob.getPrinterJob();
                          HashPrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
                          boolean printAccepted = printjob.printDialog(attr);  
                         if (printAccepted)
                     catch(PrinterException e)
      Kind regards,
        • 1. Re: printing PDF on Macintosh
          Have you tried:
          Desktop.getDesktop().print(new File("the.pdf"));
          • 2. Re: printing PDF on Macintosh
            Thanks for your help Andrew.
            Sorry there is something more to say. On the windows machine I installed a PDF printer, which i can choose in the PrintJob.printDialog() Dialog to build a PDF.
            On Macintosh there is this functionallity normally built in so there is no need to install a pdf printer, but java does not open the native Macintosh print Dialog and I'm not able to produce a PDF on Macintosh.
            Therefore I don't know which file to give to
            Desktop.getDesktop().print(new File("???"));
            • 3. Re: printing PDF on Macintosh
              Is the question not clear or is there no easy solution for this?
              I will rephrase it and i hope it gets clearer.

              On windows I have to install a third party pdf-printer and then user is able to choose this pdf-printer from the java-printdialog.
              On macintosh there is a native pdf-printer and i want to use this native printer, because i cannot find other pdf-printers for macintosh, but for this i need the native macintosh printdialog to open...
              Currently I'm not able to open any printdialog neither java nor native on macintosh.