Forums Register Login

printing from the client/browser using servlets on the server

+Pie Number of slices to send: Send
Problem Statement:
i need a facility inside a HTML page generated by some servlet or may be JSP which would allow the client to click an icon within the page and print certain parts of the page only in the printer.
The concept is actually similar to generating a customeized report. THe user gets a HTML page to view within the browser, and if he wants to print it then he has an option to print the page as a report. Actually the printing is to be done on a preformatted paper with ready-made headers and lines. A simple example might be viewing an invoice in the browser and having an option to print the contents of the invoice(HTML page) on a paper in the printer which has headers(company name , and standard lines and fields like Serial No. , Particulars, Qty, amount) already printed. The problem is the printer will be on clients computer, he'll have a standard paper with standard headers printed on it. We just need to fill the items under the header, the data to print will be same as in the HTML page the user is viewing.
How can a servlet control a printer attached to the clients computer?
Please reply..
+Pie Number of slices to send: Send
You can use the Java printing API. This allows you to format the pages anyway you like and not be tossed surprises by the user's browser. One caveat, though. Use of the printer is protected by the "sandbox". You'll have to build a signed applet.
+Pie Number of slices to send: Send
Thank you Tim for the reply..
I was just wandering if it is not possible to take control of the printer attached to the clients computer via a servlet as we take control of the browser the user is using to view the page.
+Pie Number of slices to send: Send
Well, you can't really even take control of the browser - just pass it suggestions which must pass sandbox rules. Otherwise you'd be able to do the sort of rude things other products can - like shutting down the browser, saving files without the user's knowledge and permission, etc. That's where applet signing comes in. By providing a digital certificate of authenticity from a trusted source, you (and the certificate provider) are solemnly swearing not to do anything rude, crude, and socially unacceptible, in exchange for the right to do things above and beyond the usual sandbox limitations.
Replace the word "snake" with "danger noodle" in all tiny ads.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1026 times.
Similar Threads
iReport - Printing field in the back
Printing without displaying on the browser
Print Stylesheet
jsp,printing, and konqueror web browser
Java and Printing to Linux/MS Print Servers
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:06:39.