Reputation: 31
I want to print a doc file using java. How can i do it without any 3rd party API.
As far as i know, you have to render the doc file as image and then pass it to the printer. Is there any way to render the doc file in image and then print it?
Upvotes: 2
Views: 10589
Reputation: 42020
You need not convert the document to an image. If you are using Java 6+, you can try:
File file = new File("C:\\document.doc");
Desktop.getDesktop().print(file);
The method print
in the class java.awt.Desktop
:
Prints a file with the native desktop printing facility, using the associated application's print command.
Upvotes: 4