Create Bonjour AirPrint on an iOS device

So, I realized that for the publication (service announcement) of the iOS device as a printer, I use NSNetService and set the type to _ipp._tcp .

But in order to be recognized as an AirPrint printer, requirements include:

  • AirPrint uses IPP to manage print.
  • AirPrint listens for mDNS (Bonjour / Avahi) to detect the printer.
  • AirPrint requires that the _ipp subtype be present in the _ipp ad before it considers the printer list.
  • AirPrint requires an additional TXT record, "URF", to be present and not empty before it considers turning on the printer.
  • Although this URF format (see below) seems to be a future option for Apple, all current AirPrint applications seem to send print data in PDF format.
  • When the printer is protected with a username / password, the iTunes / AirPrint daemon will send a TXT record "air = username, password".

A source

So, I'm trying to figure out how to publish a subtype and publish a TXT record to NSNetService, which I could not do. Does anyone have any ideas?

+4
source share
3 answers

This link tells you how to configure avahi to access your printer.

0
source

Try this article, it’s easy to understand, and the author responds to blog posts: http://sybaspot.com/configuring-dns-to-share-bonjour-printers-across-subnets-and-vlans-including-airprint-for- ios /

0
source

Since you are not yet showing the starting point or the blank of your code, here's another hint: you can simulate a valid AirPrint service advertisement in your local area network / WLAN, which will allow your iOS clients to print successfully to an existing printer (AirPrint or not).

Requirements: Mac with OS X.

Once you do this, now you can use something like Wireshark or tcpdump to capture packets on the wire or from the air, save and analyze them.

Then start coding your application and make it produce the same packages as the simulation.


It is known that work on OS X Yosemite (10.10.x).

Assuming ...

  • you have a Mac (book) that works with OS X,
  • this is the name of the mymac Mac mymac ,
  • its IP address is 192.168.111.111 ,
  • he has a shared printer named abcd installed (it doesn't have to be AirPrint-compatible!) and
  • the printer share does not require authentication (put DefaultAuthType none in /etc/cups/cupsd.conf )

... then you can make the abcd queue available to iOS clients.

To check this, simply run the following command in the Terminal.app window (note, the command will not return - if you close the Terminal.app window, the effect of the command will disappear!):

  dns-sd \ -P AirPrint-abcd \ _ipp._tcp,_universal \ local. \ 631 \ mymac.local. \ 192.168.111.111 \ pdl="application/pdf,image/urf" \ kind="document" \ priority="1" \ product="Model Name of my Printer" \ rp="printers/abcd" \ URF="DM3" \ Duplex="T" \ Color="T" \ note="Testing AirPrint via MacBook"\ txtvers="1" \ qtotal="1" \ printer-type="0x0480FFFC" \ printer-state="3" \ air="none" \ UUID="54321abc-1234-1234-abcd-1238e4babcd8" 

If this works (as it should), you can easily find a script or cron job that executes this command (and allows you to run it in the background) every time you boot the Mac. This remains as an exercise for the reader.

(You can run this same command unchanged even from a second, completely different Mac, if the first Mac provides a shared print queue, and all the details above correspond to the first Mac settings ...)


Background Information:

The dns-sd command-line utility is intended as a testing and development tool for anyone who inserts Bonjour, mDNS (multicast DNS) and DNS-SD (DNS-based service discovery). This is part of the OS X system since Bonjour has come to life.

The -P on dns-sd will announce the Bonjour proxy server on the local LAN / WLAN. The announcement will tell AirPrint potential customers the following information:

  • In your .local. domain .local. AirPrint device available.
  • His name is Airprint-abcd .
  • This can be achieved through the IP address 192.168.111.111 and port 631 .
  • Use the name of the print queue printers/abcd to print on it.
  • It can use PDF and URF bitmap documents.
  • No authentication required.
  • It can output duplex and color documents.

See man dns-sd more information on this utility. See dns-sd.org and these other answers for more information.

0
source

All Articles