Dec 262015
 

AirPrint is a cool technology, but what if you have printers that aren’t officially supported?  Here’s how to make it work.  Note that this was done on FreeBSD 10.1.  This may work on other operating systems, but package installation and filesystem paths will be different.

Install cups via ports, I selected both Python and Perl bindings, and Avahi for advertisement (since we’ll be using Avahi to advertise the services anyway):

After going through the various package configurations, grab a cup of coffee because there are many dependencies to install.

Enable cups:

Set up cupsd.conf.  Note that this isn’t the most secure configuration, if this system is on the internet, please make adjustments accordingly.

Start cups:

Head over to http://[IP]:631 and set up your printer.  This varies by printer, so I’ll leave this up to you.  Make sure to print a test page to ensure that cups itself is working.

Next, let’s add the needed AirPrint MIME types:

All that’s left to do now is add the actual services to Avahi.  We’re going to run a Python script that does this, but first, I had to add the cups package to Python manually.  You may not need to do this:

Download airprint-generate.py:

I modified airprint-generate.py based on a forum post, I am not sure if this is needed, but it doesn’t appear to hurt: In the section setting ‘DOCUMENT_TYPES’, add a new line just under “‘application/postscript’: True,” that says “‘application/vnd.cups-postscript’: True”.

Next, run it:

This will create a .service file in the current directory for each of the printers you have set up in CUPS.  Put these service files into the Avahi service directory:

Finally, restart avahi-daemon:

At this point,  you should be able to AirPrint from your iOS devices.