Some printer/driver combinations understand PDF files, but I'm not aware of any that know what to do with Word files. Furthermore, it looks like you're treating the contents of the file as text (which it is not) instead of binary (which its is).
Word documents have special characters in them that mean special things. In addition to what the text is, you need to know if the text should be bold, centered, italic, what font it is, what size, etc.
That data is written in the .doc file in a certain way. You need to know what those special codes are and how to interpret them. Try opening a .doc file in notepad, and you'll see a lot of gibberish. That's because notepad doesn't know how to read all that special stuff.
If you want to see all that, you'll need to figure out how to interpret the file. There may be 3rd party software packages you can get and use.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Rohit Kedia wrote:My Word Document will be in Database in a BLOB Column and I want to send that to the Printer how Can I Do that.
I doubt that there's a 100% solution, but JODConverter might be a place to start. Apache POI may also be able to do it but, from what I understand, its HWPF (Word) component is quite limited. Otherwise, there's always the OpenOffice SDK, but I suspect it'll involve quite a learning curve. There's also a product called docx4j, but I've never used it and have no idea how good it is.
It's also possible that you'll need a different solution for .doc and .docx files.
Finally, there are commercial programs, including (possibly) Word itself; although MS's own batch-style automators are either (a) abysmal, or (b) cost an arm and a leg.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
POI would help somewhat with extracting text and layout information from a document, but it has no provisions for printing. Either JODConverter or Desktop.print look more promising.
Can you share me some code snippets.
I had an alternate Solution to this Problem but I needed some assistance.
I will fetch all the BLOBS from Database and create a Word Document from it, is that possible ?
Also, I will be having multiple Blobs [different Word Files] and I want to put them Together in One Word Document , is that Possible ?
Could you hold this kitten for a sec? I need to adjust this tiny ad: