Share your Windows printers using AirPrint

When AirPrint was first introduced in iOS 4.2, I have spent some time trying to share my Windows printer to my iPad. Of course a free solution was already there, one that involved installing Apple Bonjour Service with CUPS Lite for Windows. So I’ve quickly found that solution on Google and downloaded the necessary tools, namely Bonjour Print Services for Windows and Airprint.zip, which contains the CUPS service.

Making it work was quite easy. You need to unzip the Airprint.zip file to C:\Program Files\AirPrint (on a 32-bit Windows), or to C:\Program Files (x86)\Airprint on 64-bit Windows.

The next step is registering the service: log in as a user with admin rights, click “Start”, “Run”, enter “cmd” and press “OK”.

In the console, enter the following commands:

sc.exe create AirPrint binPath= "C:\Program Files\AirPrint\airprint.exe -s" depend= "Bonjour Service" start= auto
sc.exe start AirPrint

IMPORTANT: If you use 64-bit Windows, use the appropriate Program Files (x86) directory instead.

It worked! …until iOS 5. So I’ve run the Wireshark to see if Apple changed anything to the AirPrint protocol. It was not a surprise that they did:

Luckily, CUPS Lite has several command line switches and it can be adapted to the change.

To make Airprint.exe compatible with iOS 5 and above, run the following commands from the command prompt:

sc.exe stop Airprint
sc.exe delete Airprint
sc.exe create AirPrint binPath= "C:\Program Files\AirPrint\airprint.exe -R _ipp._tcp,_universal -s" depend= "Bonjour Service" start= auto
sc.exe start Airprint

IMPORTANT: Remember to use the right Program Files or Program Files (x86) directory.

Since you’ve seen the picture and the modified entry for Airprint service, you might already have guessed that -R binds CUPS Lite to a slightly different service name (the one which my iPad was looking for). This allows the iOS 5.x devices to be able to find shared printers again.

Make sure airprint.exe is allowed through in Windows Firewall. Some tutorials will tell you to disable Windows Firewall alltogether – don’t do that, it’s a security risk!

Some tutorials will tell you to enable guest account for the sharing to work. Don’t do that, it’s a security risk. If someone accesses your network (for example cracks or guesses your WiFi key), he will be able to print anything on your printer. Use one of the user accounts on Windows instead, and when you order iOS device to print something, iOS will automatically ask you for username and password.

The above has been tested with iPhone and iPad, both running iOS 8.1.2.

PS. If you are running Linux it is still possible to use CUPS and avahi daemon to share a Linux printer to AirPrint enabled devices.