I have to print a word document from java. I could just open it and print it. But the following code print it automatically. Is there any way to pop up a print dialogue to choose printer? If the user does not wish to print it, he should be possible to cancel it. Also I need to close the word after printing. Please help me.
public static void main(String args[]) throws IOException {
Desktop desktop = Desktop.getDesktop();
File f = new File("C:\\Users\\asa\\Desktop\\resume.doc");
desktop.open(f);
Thread.sleep(5000);
desktop.print(f);
}