aspose file tools*
The moose likes Java in General and the fly likes JPS - printing to IPP printer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JPS - printing to IPP printer" Watch "JPS - printing to IPP printer" New topic
Author

JPS - printing to IPP printer

Tony French
Greenhorn

Joined: Sep 12, 2008
Posts: 2

Is it possible to use JPS (or java in general) to print to a network ipp printer? I need to be able to print to a print queue on a remote print server (i.e. CUPS). My jar file will be distributed in multiple deployments on multiple machines. So, I would like to be able to have a central print server that handles all of the printing without having to define each printer on the local application servers.

The javax.print package states the following:

"The JDK includes PrintServiceLookup implementations that can locate the standard platform printers. To locate other types of printers, such as IPP printers or JINI printers, a print-service provider can write implementations of PrintServiceLookup. The print-service provider can dynamically install these PrintServiceLookup implementations using the SPI JAR file specification."

However, I have been unable to find any such providers.

I have also tried the following two aset options with no success:

AttributeSet aset = new HashAttributeSet();
aset.add(new PrinterName("\\\\192.168.5.1:631\\printers\\MY_PRINTER", null));
//aset.add(new Destination(new URI("ipp://192.168.5.1:631/printers/MY_PRINTER")));
James Weaver Second
Greenhorn

Joined: Nov 23, 2009
Posts: 4
Ever find any info? We use java api to remote print to cups 1.2 and are wanting to upgrade to newer version of cups, but looks like as of 1.4 cups their old java api (cups.jar) is no longer supported. A JPS implementation would be nice, so we don't have to write and maintain low level ipp stuff ourselves.
Tony French
Greenhorn

Joined: Sep 12, 2008
Posts: 2
I have looked at several options, including the cups.jar, but have not yet found any solutions that I feel 100% comfortable with. For now, I have implemented a RESTFul service that wraps the JPS API. In just the past week, I have found two possible solutions that I think are worth looking at:

1) Cups4J - This project is very young and is certainly not complete, however there is active development and has some potential based on the underlying code.

2) Jipsi - I actually looked at this option a while back and turned away from it when I noticed that it didn't appear to have any active development. I have started to take another look at the project since I haven't found any other solutions that appear to be nearly as complete. In fact, what brought me back to it was that I noticed that CUPS provided a reference to the project. I downloaded the source and upgraded the Apache HTTP Client to be compatible with our environment. I had to make one other minor fix to handle an exception that was being thrown due to OrientationRequestedDefault not being passed a value, which the developers mentioned was a problem on Sun's end. Take a look and let me know how you think it compares to the cups.jar.

James Weaver Second
Greenhorn

Joined: Nov 23, 2009
Posts: 4
Hi Tony,

Thanks so much for the reply! I work for a university hospital, and remote printing is a key feature for our prescription writing application. I'm really surprised at how thin on the ground remote printing solutions for java are! I guess most applications just rely on local printing from the client/user desktop.

We are currently using an old version of CUPS and the cups.jar that came with it, but our server guys want to go to a newer version of CUPS. It caught us off guard that the cups java API is not being supported anymore. Since this is such a critical function for us I'm concerned about doing the work to upgrade and keeping a piece around that's unsupported / dead code.

I had found JIPSI, and had same concern as you (not active), but did not look carefully at code yet. I had not found CUPS4J, thanks much for that link!

I guess the fact that JIPSI implements JPS API is a leg up for it, but in our case our current solution doesn't use JPS anyway so no big deal.

I am somewhat attracted to your solution (something written in java that provides a simple http / rest interface, runs on the print server and uses reference JPS to talk to local cups printers). The bonus is that it could work for non java applications as well. The down side is that you don't want to have to reinvent IPP if the interface with client gets complicated. I think all we need right now is "give me a list of printers" and "print this PDF to printer with name blah". For other administrative functions (printer status etc) our support people will probably use console applications that come with CUPS. So, the JPS REST service idea is tempting!
Chris Wo
Greenhorn

Joined: Nov 20, 2009
Posts: 1
Hi tony,

I'm getting very close to getting it working myself but i keep getting this error... have you seen this before??

ec 8, 2009 5:08:58 PM de.lohndirekt.print.IppRequestCupsImpl send
WARNING: Cups seems to be busy - STATUSCODE 404 - going to retry in 50 ms a

Harald Weyhing
Greenhorn

Joined: Dec 08, 2009
Posts: 2
Hi guys,

A new version of Cups4J is available. Some bugs were fixed and I changed HTTP communication to use apache HTTP client to resolve problems with older CUPS versions. If you like to give it a try and provide some feedback I would really appreciate it.

Cheers
Harald
James Weaver Second
Greenhorn

Joined: Nov 23, 2009
Posts: 4
Hi Harold,

Thanks! Right now we are upgrading to CUPS 1.3, and are hoping that the old CUPS jar that did the IPP stuff will still work with that version. According to cups.org, it's no longer supported for 1.4, but should still work with 1.3. If we run into trouble with that, we may look at using your project as a replacement. If yours 1.4 only or does it work with 1.3?

jim
Harald Weyhing
Greenhorn

Joined: Dec 08, 2009
Posts: 2
Hi Jim,

Cups4J also works with CUPS 1.3.x - at least as far as I was able to test everything .

Cheers
Harald
James Weaver Second
Greenhorn

Joined: Nov 23, 2009
Posts: 4
Thanks Harald.

Right now we are still testing the old 1.2 cups jar against 1.3. If that doesn't work we will give CUPS4J a try. So far we have been able to print documents using the old cups jar, as well as receive details of all printers defined to CUPS and query job status for a given printer. We have not been able to add a printer or get a list of supported printer types back yet, but that may be a configuration issue on our new CUPS server rather than an issue using the 1.2 jar with 1.3.

Regardless of how this goes, though, I will try to checkout CUPS4j and compare its features to the features we were using from CUPS 1.2 api jar.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JPS - printing to IPP printer
 
Similar Threads
How can I send text characters to a printer device ?
Event Listeners in Java Print Service API
Java Print service
Java Silent Print PDF file with printer configuration
Printer trays