Share Any Printer using AirPrint on a Mac computer
Closed     Case # 10062     Affiliated Job:  BaBaDou DOT Com
Opened:  Monday, April 30, 2012     Closed:  Monday, April 30, 2012
Total Hit Count:  17966     Last Hit:  Tuesday, October 15, 2024 2:12:17 PM
Unique Hit Count:  5455     Last Unique Hit:  Tuesday, October 15, 2024 2:12:17 PM
Case Type(s):  Server
Case Notes(s):  All cases are posted for review purposes only. Any implementations should be performed at your own risk.

Request:
Through working with AirPrint and AirPlay, it turns out you can share any printer through AirPrint simply by using a Mac Computer.

Action(s) Performed:
Total Action(s): 1
Action # Recorded Date Type Hit(s) User Expand Details
10209 4/30/2012 2:38:32 PM Server 3149 contact@danieljchu.com Some sample illustrations of the configuration and dns-sd query tool are sh  Collapse ...
Last Hit: Tuesday, October 15, 2024 8:38:43 AM

Some sample illustrations of the configuration and dns-sd query tool are shown below.      





Outcome:
Through OSX Lion, under System Preferences, "Share" the printer your Mac computer uses - it doesn't matter if it is attached to your Mac through USB or via WiFi. Once the printer is shared, open Terminal and launch the following command to record the Bonjour record your computer is broadcasting.

Command to issue:
dns-sd -Z _ipp

An example of results may appear as:
_ipp._tcp PTR NetworkPrinter\032@\032vmDJCiMac._ipp._tcp
NetworkPrinter\032@\032vmDJCiMac._ipp._tcp SRV 0 0 631 vmDJCiMac.local. ; Replace with unicast FQDN of target host
NetworkPrinter\032@\032vmDJCiMac._ipp._tcp TXT "txtvers=1" "qtotal=1" "rp=printers/_192_168_201_20" "ty=Canon iR3235/iR3245" "adminurl=http://vmDJCiMac:631/printers/_192_168_201_20" "note=Help Desk" "priority=0" "product=(iR3235/iR3245)" "printer-state=3" "printer-type=0x80B0D6" "Transparent=T" "Binary=T" "Fax=F" "Color=F" "Duplex=T" "Staple=F" "Copies=T" "Collate=T" "Punch=F" "Bind=F" "Sort=F" "Scan=F" "pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png"

Take the above and use it to create your own advertisement like my sample below:
dns-sd -P "AirPrint_NAME" "_ipp._tcp,_universal" "" "631" "vmDJCiMac2.local." "192.168.27.27" "txtvers=1" "qtotal=1" "rp=printers/_192_168_201_20" "ty=Canon iR3235/iR3245" "adminurl=http://vmDJCiMac:631/printers/_192_168_201_20" "note=Help Desk" "priority=0" "product=(iR3235/iR3245)" "printer-state=3" "printer-type=0x80B0D6" "Transparent=T" "Binary=T" "Fax=F" "Color=F" "Duplex=T" "Staple=F" "Copies=T" "Collate=T" "Punch=F" "Bind=F" "Sort=F" "Scan=F" "pdl=application/octet-stream,application/pdf,application/postscript,image/jpeg,image/png" "URF=NONE"&

Seven things need adjusted:
1st, Update the Name, in my case I named it "AirPrint_NAME" this will be the name as it will appear on your iOS device
2nd, Add a "2" or something to make your advertisement unique as in my case I entered it as "vmDJCiMac2.local."
3rd, Update the IP "192.168.27.27" to reflect the IP of your Mac computer - this needs to be static, so you may want to setup a DHCP reservation on your router
4th, Copy from the output of your dns-sd -Z command everything "txtvers=1" onward replacing everything in my command up to the "URF=NONE"
5th, update "note=Help Desk" to reflect description text about your device...
6th, Leave the text output "URF=NONE" - this is required for the iOS device to see the advertisement
7th, Leave the "&" at the end of the command to let it run in the background

That's it, you should see it so long as your Mac is turned on and not asleep. You can script this or what have you on boot of your Mac to automate the startup, but if you only run it once, then when you shut down your computer and reboot, it will not begin again automatically doing just the above.

As with all Bonjour services, you must be on the same subnet for this to work; however, there are ways to advertise the mDNS record allowing multiple subnets to be aware of the Bonjour advertisements...



Profile IMG: Footer Left Profile IMG: Footer Right