Translation(s): none

Enabling an iOS device to print via AirPrint on a Debian 9 (stretch) or later CUPS printing system.

What is AirPrint and How Does it Work?

AirPrint was devised by Apple Inc to enable an iPhone, an iPad, an iPod Touch or a Mac, referred to as iOS clients (or just clients) to print without having to install drivers on the client device. More and more new printers come with firmware to support AirPrint. In fact, it would be unusual nowadays for a network-aware printer not to provide AirPrint support.

There are two technologies central to the AirPrint facility on a printer:

The broadcast mDNS packets contain information about the capabilities of the printer, its identity and its location on the network. They also utilise some extensions (not necessarily fully explained in existing literature) to the existing Bonjour specification to allow iOS clients to search specifically for AirPrint-capable printers and display them in a print dialogue.

IPP (version 2.0) is needed for print management. The client uses IPP to send the print job with information about what printer language it is in, whether it is to be duplexed, the number of copies, the resolution to be used for printing, the media output location on the printer etc.

Browsing an AirPrint Bonjour Broadcast

On Debian, avahi-daemon is essential to detect the Bonjour broadcasts from a printer. Utilities which interact with avahi-daemon are in the avahi-utils package and mDNS and DNS-SD services can be browsed wth avahi-browse.

If you don't have avahi-daemon on your system, a simple

apt install avahi-utils
service avahi-daemon start

will install and start it.

The command

avahi-browse -art > discovered

gets all broadcast print queues (and more) on a subnet and records them in the file discovered. For a view of printers only there is

avahi-browse -rt _ipp._tcp > discovered

This is the reformatted output for an AirPrint enabled HP ENVY 4520:

=   eth0 IPv4 HP ENVY 4500 series   Internet Printer  local
   hostname = [envy4500.local]
   address = []
   port = [631]
   txt = ["Scan=T"
          "usb_MDL=ENVY 4500 series"
          "product=(HP ENVY 4500 series)"
          "ty=ENVY 4500 series"

Note the line beginning URF=. This enables the client to discover the printer and also tells the client what the printer is capable of doing.

The Bonjour Printing Specification Version 1.2.1 is a good source for understanding most of the TXT Record (txt =), apart from the URF entry. For that you might find Patent US 20110194124 A1 useful.

The URF key is one of extensions to the Bonjour Printing Specification mentioned previously. Its documentation is sparse. It can be deduced from US 20110194124 that

The pdl (Page Description Language) key is important. It lists the only MIME types the printer will accept for printing. With or without AirPrint enabled the Envy 4520 will not process a PostScript or PDF document sent to it. AirPrint adds nothing to this printer's capability to deal with document types its firmware is not built to cope with.

Note the last entry in the pdl key, image/urf, known as Apple Raster. It is a fallback MIME type for the client to send to guarantee printing takes place and it is obligatory for it to be accepted by a printer claiming AirPrint compatibility. image/urf is raster data; there are no officially published details about it but it has been reverse engineered.

Actually an iOS client supports sending three MIME types: application/pdf, image/jpeg and image/urf. It also knows what data types the Envy 4520 will accept. Therefore, a JPEG photo would be sent to the printer as image/jpeg and anything else would go as the fallback image/urf.

If the pdl key for the printer had been


a PDF would be sent unaltered and everything else as image/urf. The fallback image/urf isn't needed for the PDF because application/pdf is the first supported MIME type found in the key and the client knows the printer to be capable of printing it.


Printing from an iPhone, an iPad, an iPod Touch or a Mac to an AirPrint- enabled printer should just work.

Upstream CUPS and AirPrint

It didn't take long after the introduction of AirPrint for people with iOS clients to want to print to their non-AirPrint printers by having CUPS advertise queues which a client would be happy to deal with. However, upstream's position on including AirPrint support in mainline CUPS is expressed in Issue #4341 and Issue #4357:

  Sorry, but we do not support AirPrint for shared printers served by CUPS.

  CUPS does not support iOS. The two are not compatible,

This view is expanded on with

  CUPS does not support everything that AirPrint needs, and many drivers
  do strange things (particularly on OS X) when you don't go through the
  local print dialog.

  Generally speaking you can get away with it for common office printers
  using US Letter and A4 paper, but that's about it.

And elsewhere:

  Printing of emails and web pages to Letter/A4 media generally works, but
  as soon as you go beyond that things fall apart pretty quickly.  Here is
  a short list of what does not work when using CUPS as an AirPrint

  - Ready media (that's how you get to pick media sizes on iOS)
  - Many printer status keywords ("out of paper", etc.)
  - Proper media selection and scaling when printing photos
  - Proper media selection, rotation, and scaling when printing PDFs
  - Duplex printing with some drivers
  - Color/grayscale mode
  - Copies (yes, really!)

  Some of these deficiencies would require major changes to CUPS and its
  driver architecture to fix, others require driver and (in some cases)
  printer firmware updates to correct.

OpenPrinting CUPS' stance on supporting AirpPrint is expressed in pull request #27. After a period of development, the changelog for CUPS v2.4b1 (27th October 2021) was able to announce:

- Added support for AirPrint and Mopria clients (Issue #105)

Debian CUPS and AirPrint

There are many users who wish to print from an iOS client to an incompatible printer. With the idea of emulating an AirPrint printer the necessary conditions for success are:

The first condition is met by setting up a print queue for the printer in the usual way. Bonjour broadcasting is automatically done when avahi-daemon is installed. Fulfilling the second condition requires avahi-daemon to broadcast a DNS-SD service type of _ipp._tcp or _ipps._tcp.

In principle there is no great problem in meeting the advertising and communication conditions. The problem arises in deciding what to put in a TXT Record to ensure a client recognises the broadcasts as coming from an AirPrint print queue and successfully prints to it.

In a process that to some extent involved trial and error, the Debian printing system has been patched and enhanced as follows:

After converting the Apple Raster to a PDF the filtering system can proceed with completing the remaining processes.


Printing from an iPhone, an iPad, an iPod Touch or a Mac to any correctly set up Debian print queue should just work providing the avahi-daemon is running.


The way iOS clients handle AirPrint printing is determined by Apple and is likely to evolve over time. Future changes to iOS might impact on the ability of avahi-daemon and CUPS to service printing requests from a client; it has happened in the past.


Till Kamppeter <> for implementing AirPrint support in Debian and Ubuntu and Didier 'OdyX' Raboud <> for supporting and overseeing its inclusion into Debian.

See Also