Discussions
Categories
- 385.5K All Categories
- 4.9K Data
- 2.5K Big Data Appliance
- 2.4K Data Science
- 453.4K Databases
- 223.2K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 47 Multilingual Engine
- 606 MySQL Community Space
- 486 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.2K ORDS, SODA & JSON in the Database
- 585 SQLcl
- 4K SQL Developer Data Modeler
- 188K SQL & PL/SQL
- 21.5K SQL Developer
- 46 Data Integration
- 46 GoldenGate
- 298.4K Development
- 4 Application Development
- 20 Developer Projects
- 166 Programming Languages
- 295K Development Tools
- 150 DevOps
- 3.1K QA/Testing
- 646.7K Java
- 37 Java Learning Subscription
- 37.1K Database Connectivity
- 201 Java Community Process
- 108 Java 25
- 22.2K Java APIs
- 138.3K Java Development Tools
- 165.4K Java EE (Java Enterprise Edition)
- 22 Java Essentials
- 176 Java 8 Questions
- 86K Java Programming
- 82 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 208 Java User Groups
- 25 JavaScript - Nashorn
- Programs
- 667 LiveLabs
- 41 Workshops
- 10.3K Software
- 6.7K Berkeley DB Family
- 3.6K JHeadstart
- 6K Other Languages
- 2.3K Chinese
- 207 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 474 Portuguese
printing PDF on Macintosh

Chang
Member Posts: 26
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
Chang
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
Answers
-
Have you tried:
Desktop.getDesktop().print(new File("the.pdf"));
? -
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 toDesktop.getDesktop().print(new File("???"));
regards,
Chang -
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.