views:

47

answers:

3

Does anyone have experience with printing directly to a Photo ID Card printer in a web browser?

I have a web application that manages user data, photo, and so forth. I'd like to add a Print ID Card feature to it. The web application is a single page javascript application that talks to a RESTful web service via JSON. I'd like to display what the printed card will look like on both the front and back for approval before the user clicks the print button.

I'm considering ways to do this:

  • Generate front and back JPG or PNG images to print on the server, send them to the client for display and approval, and then somehow send the images to the printer.
  • Use javascript with SVG or Canvas to display the card to print in the UI for approval, then somehow send the SVG/canvas data to the printer.
  • Generate a PDF and print the PDF to the printer.
  • Use Flash to display and print
  • Use a Java applet to display and print
  • Something else?

I'm looking for any sort of guidance that anyone can provide on any aspect of doing this. If you've been down this road before, I'd appreciate hearing from you. In particular:

  • What resources did you find to learn about doing this?
  • Are there any particular printer brands that work better than others?
  • Are any of the ways I describe above better, and why?
  • Could I also print barcodes, magnetic stripe data, sim card data, and so forth?

I know this question might be a shot in the dark, but any information would help. Thanks!

+1  A: 

From a 40,000 foot view. I can think of two Microsoft Centric ways... both involving processes outside of the browser.

1) Use Internet Explorer, and write an IE Plugin application that plugs into the browser through an object declaration, and is passed Javascript field values for data, images, etc. All communication to the printer/print-driver is handled by the remoting .dll. I suppose you can also do something similar with a Firefox plugin. I use this method to process data from credit-card readers directly into a browser screen.

2) If the data is coming from a database, write an independent agent that runs on a workstation hooked to the printer. When you click the "print" button on the browser form, it sets a flag in the database. The agent periodically scans for this flag, and prints the resulting record. I've used this method for printing on Eltron or Zebra card printers. In fact I used MS-Access as the agent.

RichO
Actually, this app is designed to work primarily in Chrome, Safari, or Firefox. It will work in IE as well, but I cannot require IE, nor want to make an IE or browser specific solution. So your first solution won't work. The second idea however is worth considering. I'll give that some thought. Thanks for the ideas.
Tauren
To elaborate, I actually create a record in a separate table that cross-references the data record with the requesting workstation. Then I have the agent-application look for requests from that (and/or other) workstations, print the job, and then delete the record.
RichO
A: 

From a another 40,000 foot view - if its simple layout (one photo and few lines of text) and you do know which browser will be used to print - you can style it all via css.

I assume that the user actualy printing the card has the printer installed to his computer.

Also no promel what s so ever with printing barcode (it's justr an image - if reasnable good printer is used)

Hurda
Thanks, yeah I figured barcodes weren't a problem. That question pertained more to printing mag stripes. CSS, images, and text might work, but the card templates also have a background, and normally CSS backgrounds don't get printed.
Tauren
Also, some of these printers require control codes for proper orientation, etc. It seems like that would make a browser direct solution difficult.
RichO
@RichO: that's my concern and a primary reason why I ask if others have been down this path before.
Tauren