iPad や iPhone から設定不要、ワイヤレスで一発印刷できる AirPrint を使いたい! そこで、Debian/GNU Linux 上に AirPrint サーバを建て、LAN 接続のファクシミリ複合機 MF-UX60CL/CW に印刷できるようにしてみた覚書。
AirPrint で印刷できるようにする以前に、Debian 単体で印刷できるように設定しなければなりません。MF-UX60CL のドライバ ソフトウェアは、公式には Windows OS 用のものしか配布されていませんが、Mac OS X のそれと同じように Linux ベースの HP プリンタ用ドライバが利用できます。
$ su # apt-get update # apt-get install foomatic-db-hpijs # apt-get install cupsys # apt-get install cupsys-bsd
cups
というのがプリンタの共通管理システムで、便利なことにブラウザから設定できる...んですけど、そのままでは他マシンから接続できないので cups の設定ファイルを修正します。
# 標準ではローカルマシンからしか接続できないので #Listen localhost:631 # とりあえず何も考えずに全部許可 Listen *:631 # Restrict access to the server... <Location /> Order allow,deny # サーバにアクセスできるよう LAN について許可を追加 Allow from 192.168.1. </Location> # Restrict access to the admin pages... <Location /admin> Order allow,deny # サーバにアクセスできるよう LAN について許可を追加 Allow from 192.168.1. </Location>
設定ファイルを保存した後、サービスを再起動します。
$ sudo /etc/init.d/cupsd restart
Web ブラウザから http://server.example.com:631/
を開くと管理画面が表示されます。バージョンは 1.3.8 でした。ここでプリンタを登録します。
socket://UXMF60.home.magicvox.net
以上です。その後、プリンタの一覧からテストページの印刷が行えるので試してみましょう。
AirPrint は Bonjour を利用してプリンタを見つけます。でもって、Linux における Bonjour の Zeroconf 仕様の実装が avahi らしいので、avahi-daemon のサービスを登録してやればよいとのこと。/etc/avahi/services
以下に printer.UX-MF60CL.service
を作成します。ファイル名は末尾が .service
で終わるようにします。
<?xml version="1.0" standalone='no'?> <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <service-group> <name>UX-MF60CL</name> <service> <type>_ipp._tcp</type> <subtype>_universal._sub._ipp._tcp</subtype> <host-name>server.example.com</host-name> <port>631</port> <txt-record>txtvers=1</txt-record> <txt-record>qtotal=1</txt-record> <txt-record>rp=printers/UX-MF60CL</txt-record> <txt-record>ty=UX-MF60CL</txt-record> <txt-record>note=Home MagicVox.net</txt-record> <txt-record>product=(GPL Ghostscript)</txt-record> <txt-record>printer-state=3</txt-record> <txt-record>printer-type=0x3056</txt-record> <txt-record>Transparent=T</txt-record> <txt-record>Binary=T</txt-record> <txt-record>Duplex=T</txt-record> <txt-record>Copies=T</txt-record> <txt-record>pdl=application/pdf,application/postscript,application/vnd.cups-raster,application/octet-stream,image/png</txt-record> <txt-record>URF=W8,SRGB24,CP1,RS600</txt-record> </service> </service-group>
次に、/etc/cups/cuspd.conf
に以下の行を追加。
ServerAlias *
最後にサービスを再起動して完了です。
# /etc/init.d/avahi-daemon restart # /etc/init.d/cups restart
とりあえずこれで AirPrint で印刷できるようになりましたが、printer.UX-MF60CL.service
をそのまま他所からパクってきたために設定が甘いのか、常にカラー印刷になってしまいます。あと、ネットワークのセグメントが異なると AirPrint がプリンタを発見できません。この辺りは仕様なので仕方ないかも。