Wednesday 28 December 2011

Printing from the iPad 2

Having been a happy iPad owner for some months now, it's always niggled that we cannot print from it to the Kodak ESP 3250 printer that's hard-wired ( via USB ) to my wife's Ubuntu laptop.

Finally, I invested some small amount of time in a Google search, and found the secret sauce.

Thanks to this blog -> Hartless By Design <- I found out how to enable the required AirPlay service, using a protocol called avahi which is installed as part of the Common Unix Printing System (CUPS) subsystem.

I've already blogged about Apple and CUPS earlier today as well as a purely Linux-related problem a few years back.

However, this particular article - AirPrint with Ubuntu 10.10 - did the job.

In essence, I needed to create a file - /etc/avahi/services/printer.service  - and add the following content: -

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name>My Printer</name>
  <service>
    <type>_ipp._tcp</type>
    <subtype>_universal._sub._ipp._tcp</subtype>
    <port>631</port>
    <txt-record>txtver=1</txt-record>
    <txt-record>qtotal=1</txt-record>
    <txt-record>rp=printers/My-Printer-CUPS-Name</txt-record>
    <txt-record>ty=My Printer</txt-record>
    <txt-record>adminurl=http://198.168.1.4:631/printers/My-Printer-CUPS-Name</txt-record>
    <txt-record>note=My Printer</txt-record>
    <txt-record>priority=0</txt-record>
    <txt-record>product=virtual Printer</txt-record>
    <txt-record>printer-state=3</txt-record>
    <txt-record>printer-type=0x801046</txt-record>
    <txt-record>Transparent=T</txt-record>
    <txt-record>Binary=T</txt-record>
    <txt-record>Fax=F</txt-record>
    <txt-record>Color=T</txt-record>
    <txt-record>Duplex=T</txt-record>
    <txt-record>Staple=F</txt-record>
    <txt-record>Copies=T</txt-record>
    <txt-record>Collate=F</txt-record>
    <txt-record>Punch=F</txt-record>
    <txt-record>Bind=F</txt-record>
    <txt-record>Sort=F</txt-record>
    <txt-record>Scan=F</txt-record>
    <txt-record>pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png,image/urf</txt-record>
    <txt-record>URF=W8,SRGB24,CP1,RS600</txt-record>
  </service>
</service-group>

replacing My Printer with the alias of the printer ( Kodak ), My-Printer-CUPS-Name with the "network" name of the printer as it appears in CUPS ( https://localhost:631/admin ) KODAK-ESP-3200-Series-AiO and the IP address - 198.168.1.4 - with the loopback IP address - 127.0.0.1.

Having done this, I needed to add a single line: -

ServerAlias *

to /etc/cups/cupsd.conf and then restart CUPS: -

sudo /etc/init.d/cups restart

From that point on, any print dialogue on the iPad ( I was actually trying to print an invoice from within Safari ), will show up Kodak as an AirPrint printer: -



No comments:

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...