File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet To Print Ms-Word files on client side

 
amarshi mohanty
Ranch Hand
Posts: 110
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ankit Garg
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can find a list of libraries available to write a word file (or other formats) here...
 
amarshi mohanty
Ranch Hand
Posts: 110
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are examples of the use of POI here...
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
amarshi mohanty
Ranch Hand
Posts: 110
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 110
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so some way has to be there to do the same with word.

Why? PDF is very different from DOC.
 
amarshi mohanty
Ranch Hand
Posts: 110
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic