Skip to content

Printers! Oh what Hellish Joy

Apple AirPrint w/ CUPS

Setup your printer(s) in cups and make sure it's working and shared (and sure you have avahi installed too).

Now create a service file in /etc/avahi/services that has your printers name. Make sure you're matching this exactly to what you have in cups eg. HL2230 in cups becomes: /etc/avahi/services/AirPrint-HL2230.service

Here's my jinja template:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">AirPrint {{ printer_name }} @ %h</name>
<service>
<type>_ipp._tcp</type>
<subtype>_universal._sub._ipp._tcp</subtype>
<port>631</port>
<txt-record>txtvers=1</txt-record>
<txt-record>qtotal=1</txt-record>
<txt-record>Transparent=T</txt-record>
<txt-record>URF=none</txt-record>
<txt-record>rp=printers/{{ printer_name }}</txt-record>
<txt-record>note={{ printer_name }}</txt-record>
<txt-record>product=(GPL Ghostscript)</txt-record>
<txt-record>printer-state=3</txt-record>
<txt-record>printer-type=0x2900c</txt-record>
<txt-record>pdl=application/octet-stream,application/pdf,application/postscript,application/vnd.cups-raster,image/gif,image/jpeg,image/png,image/tiff,image/urf,text/html,text/plain,application/vnd.adobe-reader-postscript,application/vnd.cups-pdf</txt-record>
</service>
</service-group>

Now restart Avahi (and enable ipp on firewalld) and enjoy having CUPS enabled AirPrint printer even if it's a 25 year old laser printer like mine.