tags:

views:

73

answers:

2

Hi all,

our application is a Java webbased application which is used by a number of different organizations and which we host ourselves.

I'm currently struggling with the described issue. In our application we have a mass printing functionality that spits out PDF file's, generated by Apache FOP, which the user can then print. The problem is that sometimes some of those pages need to be printed in one printer(or a tray of one printer), the second one somewhere else and the third page in the same printer/tray as the first one.

My original intent was to use Adobe Javascript because it seems that it allows for a per-page printer selection(unfortunately no tray selection which is currently not supported). I could then solve the tray selection by selecting different printers who each have a different default tray. The last part is the problem:

So my question is, does someone know how, or if it's possible, to create network printers with default trays? This would also mean that a network printer needs to be able to have multiple IPs, each with a different setting.

PS: When writing this, I realized it may be more of a sysadmin type of question. However, considering this problem is programming related I think it's belongs here.

A: 

Network printers don't need to have different IP addresses; windows printer can point to same IP and use same driver, so what you are trying to achieve is possible (then each printer can have different default settings - trays, etc...)

Alternatively, you can check for Java libraries that would allow you to print PDFs, for example this post talks about one (might not be as stable or complete as you require)

Unreason
right, but we're not talking about Windows here, our application on our server has to recognize those printers so that we can integrate it in our PDF's. That way we can have each page set to be printed automatically.
rbottel
@rbottel, ah yes I was thinking that portability might go down the drain. Well, I must admit I don't know how do you actually talk to the printer from Java (I though your java was getting hold of windows printer profiles). Now, if having a different IPs for the same printer is all it takes then check your printer, it might support multiple IPs or you could do DNAT on your router. Both approaches *are* hackish (looks to me there has to be a more appropriate way).
Unreason
Yes, like I said in my question, we host our application but multiple , large, health care organizations use this functionality. So it needs to be configurable from a sysadmin point of view. However, getting a hold of Windows profiles might not be a bad idea, that way sysadmins could make sure the necessary printers are available and we could query them by name or something.
rbottel
A: 

By creating multiple PDFs and printing them directly from Java, your can set all the options you want to route your rpints to the right tray. The "media" parameter lets you choose the tray.

Guillaume
Thanks for your answer, however we have had serious problems with using Java Applets so I dont think we can use Java to print directly. :)
rbottel
Your comment on the other answer say that your application on the server has to detect printers to integrate them. It makes me think that your server can communicate with the printers. Cant you print directly from the server in that case ?
Guillaume
Or if applets are a problem (I can understand that), could you maybe write a small Java Webstart printing helper ? If your deployment environnement is sufficiently controlled, it is quite easy to put in place.
Guillaume
Unfortunately we cannot communicate directly with the printers, not unless those organizations allow it. I havent heard about Java Webstart before, I'll look into it, thanks!
rbottel