tags:

views:

41

answers:

2

I'm using a CMS to create an ID-badge system. It takes the user's picture and creates a whole fancy image (PNG, if it makes any difference) around it, sized to print out on this nifty badge printer I have sitting next to me.

Right now I save the image to my computer, then open it in an image program and print it. But that seems a bit clunky.

I'd like to make it so that the admins can just click a button (like "Print badge") and it will print the image to the badge printer. However, any time I try to print something from inside a browser it tries to put on a header/footer with time/URL/etc, and that obviously doesn't work with the whole badge thing.

Is there any way to make a link that will cause the image to be opened in a separate program*? Or a way to get the browser to not print out all the extra crap along with the image?

*There is only one badge printer and one computer that will talk to it, so it is ok to say "This will only work if you have XYZ installed".

Thanks!

A: 

What matters is the OS and web browser of the machine that's viewing the image.

It used to be easier to map specific mime-types to a helper application ... you'll probably have to check if the browser even supports it these days. Some browsers will look at the file extension ignoring the mime-type if it's a mime-type they don't recognize.

You'll likely have to play with your setup and see what works, as I haven't had to do this for a few years, and can't remember what our final solution was.

... another option would be to try generating PDFs on the fly, with the image and the rest of the badge laid out, and send that to the printer.

Joe
I'm guessing the computer is XP/IE7.According to http://stackoverflow.com/questions/1153010/force-mime-type-in-browser-with-javascript , it looks like mime types are pretty much ignored. Hmmmm.
Eileen
A: 

Look at this google "i am lucky" website: http://www.alistapart.com/articles/goingtoprint/

A website cannot know the hardware connected to the visitor computer. So if you are working on a intranet website, you can find some applet letting you to choose a printer. Or use a mime-type binding to let the browser open the correct program according to the extension. Or use pdf.

enguerran