At home, we were missing the ability to print from our iPad or iPhones. While I’m not an OS zealot (anymore), I did upgrade to an iPhone last month, and have had an iPad for a while now. They’re very useful for casual computing, checking email, browsing. But if we needed to print something, it was a hassle to fire up a laptop or desktop computer to use our networked printer.
It turns out that Apple’s AirPrint uses DNS Service Discovery, an open standard. There are programs out there for Windows and Mac to let you share a printer attached to that OS via Airprint. It turns out, you can use it on Linux if you run the Avahi daemon and CUPS. Of course someone has already figured out how to do it: CUPS with Apple AirPrint, using a python script airprint-generate.
I was following the instructions, but the airprint-generate.py program would not generate the XML file to make it all work. Diving into the code, I saw that the printer had to be configured as a shared printer in CUPS, which makes total sense. I didn’t have it configured that way, since its a network printer, any other device could connect directly to the printer server. The setting can be changed through the cups web interface or by adding the line below to your printers.conf file. airprint-generate.py will now find your printer and generate the configuration file to add to your avahi services directory.
The one downside to this setup is that the computer running cups + avahi has to be on for this to work. But, you could buy an inexpensive ARM device, like the upcoming Raspberry PI or another one listed here and build yourself a custom, Airprint compatible printer server.