• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet To Print Ms-Word files on client side

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are examples of the use of POI here...
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic