my dog learned polymorphism*
The moose likes Servlets and the fly likes Printing from JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Printing from JSP" Watch "Printing from JSP" New topic
Author

Printing from JSP

Gobind Singh
Ranch Hand

Joined: Aug 04, 2006
Posts: 62
I have a web page with a hyper link on it labeled 'PRINT'

The requirment is that the print link needs to send a document to a printer via CUPS on linux.
The document is stored on disk (within the directory structure of the web server).

I am using Jonas web server (which uses Tomcat for its servlet container) installed on Linux.


Any ideas on how I can do this? Is there a printing API for web applications that I need to use?

The steps that i need to take are:

1.user clicks on the PRINT link
2.Servlet determines the session id of the user
3.Servlet grabs the document associated with the session Id from disk
4.Servlet sends the document to a printer via CUPS
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61043
    
  66

Where is this printer connected?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Gobind Singh
Ranch Hand

Joined: Aug 04, 2006
Posts: 62
The printer is on another server.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61043
    
  66

Is prinintg server-to-server a feature of CUPS (with which I am unfamiliar)? It's not a feature of any servlet container.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Containers don't provide any printing functionality but a Google search for "java.awt.print.PrinterJob" and "lookupPrintServices" will bring up plenty of information for finding and using printers in a Java App.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Gobind Singh
Ranch Hand

Joined: Aug 04, 2006
Posts: 62
Thanks, I followed your suggestion and found some good examples.
Hopefully I will be able to incorporate them into my webapp.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printing from JSP