Search code examples
javajavascriptflashprintingid-card

Print Photo ID Card to a plastic card printer from web site


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!


Solution

  • My company did this using option "2", e.g. an agent (actually an MFC app) running on a machine with a card printer attached.

    The agent periodically checks an internet URL looking for new print jobs; print jobs are defined using scripts generated on the web server, the script includes details like mag stripe data to be encoded, user names/pictures and where to print them on the card stock, and so on. The agent posts back to the server after a successful print job. Posting back to the server is important because card printers tend to fail regularly.

    The big benefit to this approach is that multiple users can share a single printer so you don't need to buy a printer for each workstation where card registration occurs. Card printers can be fussy and require a lot maintenance, so it's easier to support a single printer.

    Another benefit is that you don't have to write plug-ins for all the browser platforms you want to support. Finally, it lets users with Linux/MacOS print cards using the system (as long as they are willing to setup a windows machine to drive the printer.)