Printing from your iOS devices through CUPS

I finally followed through in setting up and sharing my Canon MP620 through my Linux homeserver with CUPS. This part is straightforward – install cups, cups-backend-bjnp (for the network communication with the MP620), gutenprint (for printer drivers) and then going to <host>:631 and adding the network printer using the printer’s static IP address (CUPS network printer discovery works great too).

One advantage that I am a little embarrassed to admit to not having realized sooner is that this now allows an easy setup to print directly from iOS devices to my printer even though my printer is not AirPrint capable. The trick is that CUPS has native AirPrint support and as long as you enable it, you can easily print directly from your iOS devices with this setup.

The setup for enabling AirPrint support from CUPS is as follows:

First, you need to setup a new avahi service daemon for the printer – an excellent script to generate the avahi service definition is here. In my case, I needed to install CUPS development library and pycups for Python CUPS bindings to allow this script to run. The final step is to copy the generated avahi script definition to /etc/avahi/services and then restart the avahi service. Here are the set of commands to set all of this up:

sudo apt-get install libcups2-dev
sudo pip install pycups
wget "https://raw.githubusercontent.com/tjfontaine/airprint-generate/master/airprint-generate.py"
python3 airprint-generate.py
sudo cp AirPrint-Canon_MP620_series.service /etc/avahi/services/
sudo systemctl restart avahi-daemon

At this point, everything should be setup and you should be able to see the printer in iOS device print dialogs. I do wish I had realized this benefit of setting up a CUPS printer shared through my Linux home server as this makes it so much easier to print things from the devices we are on rather than going to a specific device for our print workflows.

2 Replies to “Printing from your iOS devices through CUPS”

  1. I found this while searching for a method to remote print from my iPhone over the internet to my home printer without paying a fee for a service. So far I have no clue, it’s even difficult to find the correct search terms. Have you ever tried this? Is it possible?

    1. Yes – it should be possible by exposing your CUPS server to the Internet. However, it is not advisable as this is not very secure. A better option would be to setup some form of VPN that allows your iPhone to connect to the home network when outside and then print as if you are on the home network.

Leave a Reply

Your email address will not be published. Required fields are marked *