• 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

Java and Printing to Linux/MS Print Servers

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

we have a requirement for our J2ee based web-app to submit print jobs to both Linux and Microsoft based print servers. I have looked at Java Print Service, but this doesnt seem to address the above problem.

Can anybody point me in the right direction here, eg open source projects that can encapsulate this etc?


Jen
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you're intending what I think you're intending, you can't do it.

J2EE is a technology that allows a client program (web browser) to communicate with a server using the HTTP protocol. It's a lot of other things as well, but that's a good enough definition for what most people use it for.

The J2EE server cannot connect directly to a printer or printing subsystem - only the client can do that, and almost all HTTP clients are designed in a way that their only access to print services is if the user explicitly requests the HTTP client program to print. What gets printed may be context that the client got from an HTTP server, but it's the client that does the printing.

One of the reasons that this is so is because otherwise you'd have ill-intentioned websites that maliciously emptied out your paper trays and crammed printer microcode viruses into your network. Such things have been done, unfortunately.

What you're left with is usually one of the following options:

1. Create the output to be printed as an ordinary web page. The page can be printed via the browser's file/print menu command. In some cases you can also cause the browser to print automatically using JavaScript, but I don't like sites that do that because it bypasses my ability to select print options.

2. Create a PDF output and return it to the browser and allow the user to print that. The advantage of PDF's is that you can precisely control what displays where on the page. However it's more work to product and Microsoft clients aren't able to view the document directly in Internet Explorer.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic