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.