954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How can we print an MS Word document from Java

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..

tigerxx
Light Poster
35 posts since Sep 2004
Reputation Points: 10
Solved Threads: 0
 

Hi everyone,

You can't, trust me i have tried

Richard West

freesoft_2000
Practically a Master Poster
623 posts since Jun 2004
Reputation Points: 25
Solved Threads: 10
 

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.

pallavi_lodaya
Newbie Poster
1 post since Jan 2005
Reputation Points: 10
Solved Threads: 0
 

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.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You