We help IT Professionals succeed at work.

Printing in JAVA

sv1040
sv1040 asked
on
Medium Priority
319 Views
Last Modified: 2013-11-23
Hi,

I am developing a web based application with jsps, servlets and Enterprise Java Beans (Weblogic 5.1 as application server). How do I build printing feature into my application? Do I have to use applets, or is there a way I can redirect the contents of the browser to a printer (I do not want to use File-->Print option of browser). Can someone help?

Alternatively, Is there a way I can download the contents into a Word Document? (setContentType=application/msword does not work on all browsers).

Regards
SV1040
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2004

Commented:
*Cough* *cough* Help!!!  I'm choking on links!! *cough* ;-)

j/k :-)

Fair play ravindra76!! :-)

Tim
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
Well you've certainly got a lot of reading to do :)
So I'll give an abridged answer.

If you want to handle printing in a jsp (without using the browser print) then realise that the printing will be done on the server side, and NOT the client.

If you want to print on the client side then you'll need to use the browsers print option. Generally what I've done in this environment would be to include a link on any page that needs printing to another 'printable' version of the page. This printable version is simply another jsp page which is formatted for printing, and can then be printed using the browser.

You could use an applet to print on the client but this is a fair amoutn of work which can be implemented far more easily using jsp, or a report writer. Additionally you will have to sign your applet to gain access to the printer.

And one last options for printing on the server side if your data is sitting in a db is to use a report writer directly accessing the db. Far more flexible and powerful (for report printing).

Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

- Split points between ravindra76 and objects

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Venabili
EE Cleanup Volunteer

Explore More ContentExplore courses, solutions, and other research materials related to this topic.