Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

printing PDF on Macintosh

ChangSep 20 2011 — edited Sep 20 2011
Hello

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
{
     ...
     @Override
	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();
			printjob.setPrintable(fax);
			try
			{
				HashPrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
				attr.add(OrientationRequested.LANDSCAPE);
				boolean printAccepted = printjob.printDialog(attr);  
		    	if (printAccepted)
		    		printjob.print(attr);
			}
			catch(PrinterException e)
			{
				e.printStackTrace();
			}
Kind regards,
Chang

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 18 2011
Added on Sep 20 2011
3 comments
1,971 views