I have a Brother HL-2270DW laser printer, that I bought in 2014, which is still going fine almost 10 years later. As the article says "buy the Brother laser printer, it's fine".

The Brother HL-2270DW supports (wired) network printing and WiFi printing, but unfortunately its design pre-dated Apple's creation of AirPrint and the printer industry creation of IPP Everywhere (both AirPrint and IPP Everywhere were created around 2010, but took a while to become common in printer designs). Which means (a) it needs a printer driver (brlaser), and (b) while printing from Linux and macOS works fine, printing from a tablet/phone did not work.

Mostly I just ignored the lack of printing from a tablet/phone as I did not have any reason to do it very often, and for those cases I could always re-open the link/document on my desktop to print it.

However a question on the fediverse, about relaying AirPrint to an older printer, got me investigating AirPrint support for older printers again, and I discovered that someone else had got CUPS working to provide an AirPrint wrapper to my exact printer. So I wanted to give it a try.

The process of getting CUPS working as an AirPrint relay seems to have changed a bit since CUPS 2.4.0 so while the guides I found online helped a lot to point me in the right direction, I had to do some debugging after the "and now it should just work" statments in others guides. The Debian CUPSAirPrint page had lots of useful information on how it was supposed to work, but also described an slightly older setup (around Debian Buster/10; whereas I have Debian Bookworm/12).

With Debian Bookworm (aka Debian Linux 12), the CUPS version provided is 2.4.2. And it seems like there are four key steps to getting CUPS working as an AirPrint relay:

  1. Install cups and the printer-driver-brlaser (CUPS driver for the Brother laser printers)

  2. Make sure that the printer is set up in CUPS as an ipp printer (or maybe ipps or dnssd; ipp with a static IP on the printer worked for me, and Dustin)

  3. Ensure that the printer is shared in its printer setup

  4. Ensure that printer sharing is enabled in CUPS (ie, system wide configuration to enable the printer sharing features of the printers that should be shared)

With all of those steps, then the CUPS daemon seems to be responsible for advertising the printer into mDNS / DNS-SD (aka Avahi, Bonjour, etc). Which is unlike earlier versions where there was glue logic in the Debian avahi which did this readvertisement.

So, after all the dead ends were eliminated, my process was to install CUPS and the drivers for the Brother HL-2270DW laser printer (brlaser):

sudo apt-get install cups printer-driver-brlaser

then set up the printer for local printing from Linux. In my case I did this via the CUPS web admin interface, as this Debian Linux system was a home server. The web admin interface is available at:

http://localhost:631/

and by default will authenticate with a Unix user/password (possibly in some sudo/admin group) for admin tasks.

Once the printer-driver-brlaser package was installed, there was a Brother section to the printer vendor list, and the HL-2270DW was explicitly listed. Then I could choose default options for the printer, like defaulting to double sided printing. (The printer showed up via DNS-SD in the list of network printers to set up, which I did iniitally, but I ended up explicitly setting it up as an ipp://DNSNAME/ipp/port1 printer when I initially had trouble betting it to show up in AirPrint, and never went back and tried the other options again.)

While setting up the printer (or if you missed it, while "modifying" the printer setup), you can choose to "Share this printer", and you do wnat to choose that for the Brother HL-2270DW that you want to re-share back onto the network.

The final key step to get the AirPrint advertisements from CUPS working is to go to the central admin page of CUPS:

http://localhost:631/admin

and make sure the "Share printers connected to this system" option on the right hand side is ticked. It seems to default to not ticked, which means no printer sharing happens at all (even if you indicated that a specific printer should be shared at the printer level). When you select "Share printers connected to this system" and click on "Change settings" the main CUPS configuration file is rewritten with that change, and the CUPS daemon is restarted.

After those steps, especially the final system wide enabling of CUPS sharing printers, I could see the printer available for AirPrint on my iPad.

The Debian CUPSAirPrint page contains some very useful advice on debugging this setup. In particular:

sudo apt-get install avahi-utils

will install the command line tools for examining what is advertised into mDNS / DNS-SD, and is invaluable for seeing whether the right announcements are being made for AirPrint to work.

Specifically you want to run:

avahi-browse -rt _ipp._tcp

and make sure there is an advertisement that includes image/urf (the Apple Raster Format). If you are not seeing an advertisment with image/urf, then the CUPS printer sharing is not working. In particular you are probably only seeing the Brother HL-2270DW native advertisement of its capabilities, which does not include image/urf (and hence AirPrint does not work).

While debugging this I ended up running;

avahi-browse -rt _ipp._tcp  | grep image/urf

repeatedly, and as soon as I could see an advertisement with image/urf then AirPrint worked (and AirPrint did not work at all before then). (Usually there will be multiple advertisements: one set from both the printer itself and another set from the Debian Linux system with CUPS running. These cover the various service features of the printer.)

You can also install avahi-discover if you have a GUI Linux system, which will provide a graphical view of the same information as avahi-browse finds; but I found it more useful to be able to grep the output of the command line tool.

Unfortuately CUPS is planning to deprecate printer drivers entirely, although what to do about some older printers still seems to be an open question. Which means using CUPS as an AirPrint relay will probably break in a future upgrade :-/ But it might at least be possible to keep an older Linux/CUPS install running as the AirPrint bridge at that point. Or maybe there will be some other application packaging the brlaser driver into an "IPP Everywhere" printer front end, that CUPS will be willing to talk to. (From the DNS-SD advertisements, it also looks like this 2024 CUPS install might be able to act as an IPP Everywhere relay too. So that may be sufficient for the next few years.)