Share our HP LaserJet 4 with our iPads and iPhones.
If you’re using iOS devices for any type of business you’ll probably have to print a document or two eventually. Unfortunately, in order to do so via conventional means, you’ll have to buy a new printer that is AirPrint-ready or $20 software.
Today, while reading arstechnica.com I came across some news from CES that Lantronix was producing an AirPrint print server to make any networked printer AirPrint-ready. It’s going to cost $149. That prompted me to share my method for making our perfectly good, networked LaserJet 4, AirPrint-ready.
You’ll need a Mac. I’m still running OS 10.6.8 on my Mac Mini. You also need to share your networked printer from your Mac.
- Create a bash script with the command to create a new Bonjour service that supports AirPrint: /somewhere/airprint-hack.sh
#!/bin/bash dns-sd -R "airprint LaserJet 4 @ mini" _ipp._tcp.,_universal . 631 txtvers=1 qtotal=1 rp=printers/LaserJet_4 ty="HP LaserJet 4 - Gutenprint v5.2.3" note="Office" printer-state=3 printer-type=0x1016 Transparent=T Binary=T Fax=F Color=F Duplex=T Staple=F Copies=F Collate=F Punch=F pdl=application/pdf URF=none
- Create a new plist file that executes the script at startup: /Library/LaunchDaemons/local.mini.airprint-hack.plist
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>local.mini.airprint-hack</string> <key>ProgramArguments</key> <array> <string>/Library/LaunchDaemons/airprint-hack.sh</string> </array> <key>LowPriorityIO</key> <true/> <key>Nice</key> <integer>1</integer> <key>UserName</key> <string>root</string> <key>RunAtLoad</key> <true/> <key>Keeplive</key> <true/> </dict> </plist>
- Load the plist into launchd
sudo launchctl load /Library/LaunchDaemons/local.mini.airprint-hack.plist
- It should load dynamically but I restarted to test that the printer was available via AirPrint at startup.
- I used Bonjour Browser to figure out what the Bonjour service for my shared LaserJet 4 looks like. Then, created the dns-sd command to insert into the bash script based on the Bonjour Browser output.
- Using this method, you’ll end up with two Bonjour services for the same printer. I’m not sure what the impact is since I only have the one Mac.