aspose file tools
The moose likes Other Open Source Projects and the fly likes Servlet To Print Ms-Word files on client side Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply Bookmark "Servlet To Print Ms-Word files on client side" Watch "Servlet To Print Ms-Word files on client side" New topic
Author

Servlet To Print Ms-Word files on client side

amarshi mohanty
Ranch Hand

Joined: Jul 01, 2008
Posts: 110
Hi All,
I am looking for a code to print ms-word side using a servlet in client machine.
If any code or example or sugegstings available,please share...


Thanks
Amarshi


SCJP (97%), SCWCD (95%))
Ankit Garg
Saloon Keeper

Joined: Aug 03, 2008
Posts: 9189
    
    2

You can find a list of libraries available to write a Word file (or other formats) here...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
amarshi mohanty
Ranch Hand

Joined: Jul 01, 2008
Posts: 110
Thanks Ankit for the fast reply.
I also read that poi can solve the problem..but I m not getting how it will work.do you have any links avail.


Ankit Garg
Saloon Keeper

Joined: Aug 03, 2008
Posts: 9189
    
    2

There are examples of the use of POI here...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35258
    
    7
Nothing a servlet does can cause a file to be printed on the client side. (And POI has no provisions for printing to begin with.) Why can't the user decide whether or not to print a document?


Android appsImageJ pluginsJava web charts
amarshi mohanty
Ranch Hand

Joined: Jul 01, 2008
Posts: 110
Well the user has to click a print button and the word.doc will be moved to printer for printing without displaying on the browser.
My code is working on server side not in client side.
Someway i need to use javascript to allow the printing.
But i am not findng any javascript method avail in the existing .class file that i can use to invoke at runtime.


Amarshi
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35258
    
    7
JavaScript can be used to invoke the "print" method that will cause the print dialog to pop up for the current web page, but it has no provisions for printing any other kind of document.

Note that the web app being allowed to print documents on the client without any user interaction would be a bad security risk; that's why it's not possible.
amarshi mohanty
Ranch Hand

Joined: Jul 01, 2008
Posts: 110
But i am able to print pdf file directly to printer:
pdfCopy.addJavaScript("this.print({bUI: false, bSilent: true, bShrinkToFit: true});",false);


so some way has to be there to do the same with word.'
Conversion to .pdf from word will be the last idea.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35258
    
    7
so some way has to be there to do the same with word.

Why? PDF is very different from DOC.
amarshi mohanty
Ranch Hand

Joined: Jul 01, 2008
Posts: 110
PDF is not a MS file.
for pdf there is iText.jar which provides all the manupilations.But less info is available for handling ms-word file using POI.jar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet To Print Ms-Word files on client side
 
Similar Threads
Printing word documents from Servlet
How to print
check for an installed application on the client side(eg. acrobat reader)
disable word print option.
Printing a web page using the Printable class