This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 31st, when you will be able to use this site as normal.

    Forum Stats

  • 3,890,899 Users
  • 2,269,649 Discussions


printing PDF on Macintosh

Chang Member Posts: 26
edited Sep 20, 2011 2:38PM in Abstract Window Toolkit (AWT)

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,


  • User_64CKJ
    User_64CKJ Member Posts: 7,279 Silver Badge
    Have you tried:
    Desktop.getDesktop().print(new File("the.pdf"));
  • Chang
    Chang Member Posts: 26
    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("???"));
  • Chang
    Chang Member Posts: 26
    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.
This discussion has been closed.