• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java and Printing to Linux/MS Print Servers  RSS feed

 
Jen Rich
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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
 
Tim Holloway
Saloon Keeper
Posts: 18797
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!