views:

272

answers:

0

Ok, I understand that this is a fairly common question to ask. But I'm not asking if it's possible with just a browser, JavaScript, and CSS because I know it's not.

I want to be able to have some method of having the page print to a specific client-side printer.

Let's say we have page X and Y. On page X I want it to print to printerX and when viewing Y, I want it to print to printerY.

A requirement is for this to be a cross-browser solution. Here are some solutions I've come up with:

  1. Write a JavaScript library that will work with jsPrintSetup for FireFox and MeadCo's ScriptX for IE that will allow printing to specific printers. The main downside to this is that the licensing issues with MeadCo's "advanced" version: it's expensive! I want free!

  2. Develop something in Silverlight. Oh wait! SL4 introduced printing support but guess what? You can't programmatically assign the printer to print to. Lovely.

  3. Develop something in Flash. I've Googled and Googled but couldn't find any Action Script for selecting a specific printer.

  4. Develop something in Java. I haven't been able to see a good example of an applet printing the whole page, but maybe it's just my unfamiliarity with the Java Applet API. (EDIT: Discovering Available Printers in Java is somewhat related).

I prefer options 2-4 but don't know if it's even possible with their respective API's. I don't like the idea of doing number 1 because it involves having the client side install something that isn't as common as Flash, Java and Silverlight.

This cannot be a server-side print. I'd prefer to leave all formatting to the browser (CSS) or somehow with Silverlight and C# (not Java or ActionScript since it's an ASP.NET application and I'd prefer my language to stay the same).

Even if it was something as a Java applet that printed the whole "page" and the CSS using media="print" would format the page accordingly.

Thanks very much in advanced for suggestions.