HI,

How can we print an MS Word document from Java ???
We can print .txt files, but while printing .doc, it gives junk chars in print out when we set
DocFlavor docFlavor = DocFlavor.INPUT_STREAM.AUTOSENSE;

I tried,
1.DocFlavor docFlavor = new DocFlavor("application/msword", "java.io.InputStream");

2. DocFlavor docFlavor = new DocFlavor("application/vnd.ms-word", "java.io.InputStream");

and got PrintJobFlavorException

It would be helpful if any one could help me out..

Thanks in advance..

Hi everyone,

You can't, trust me i have tried

Richard West

Hi,

Even We have some requirement to print the Word document from JAVA. How can we achieve that?

One way we thought is to convert word to pdf and then pdf to ps to print the document.
Can anyone suggest some other solution or how to convert word to pdf from JAVA

Thanks in advance.

http://jakarta.apache.org and look for POI.
It's not perfect in that it doesn't understand all capabilities of MS Word but it understands pretty much all core capabilities.