I travel a fair bit and, on occasion, have the need to print to my home color laser printer. Printer sharing in OS X works great over the local area network (LAN), but trying to print from across the country to my home printer would seem to require opening up my home firewall to the outside world, which is something I really don't want to do. For unix gurus, the following hint may seem pretty basic, but it does use some unique OS X Tiger features, like Automator and PDF Services.
As part of the CUPS printing architecture, the command line tool lpr allows printing many types of files out of the box, including PDFs. OS X Tiger includes a great feature known as PDF Services, which allows the creation and manipulation of PDF files through the standard print dialog for any OS X printer. OS X also includes the secure shell, SSH, allowing secure, remote access across the internet. These three features allowed me to create a simple workflow to print to my home printer from anywhere with internet access. This hint assumes the following:
Since one can forward commands to a remote host through SSH, including the lpr command, and one can pipe input into that forwarded command, printing a PDF remotely to a CUPS-enabled computer is relatively straighforward shell command:
cat filename.pdf | ssh user@remotehost.org lpr
This command passes the content of the file filename.pdf to the remote lpr command via the user account at remotehost.org. The file will print on the default printer for the remote host. Choosing a specific printer is fairly easy to do using the -P destination option for lpr. See the man lpr command in Terminal to alter the script below to your specific needs.
on run {input, parameters}
repeat with i in input
set cmd to "cat " & quoted form of POSIX path of i ¬
& " |ssh user@remotehost.org lpr"
set theResult to do shell script cmd
end repeat
return input
end run
I saved this script in ~/Library/PDF Services. If you don't have that directory, either create the directory in the Finder or, alternatively, in the Terminal with a mkdir ~/Library/PDF\ Services command. The backslash before the space in PDF Services escapes the space from the shell, so that the name is parsed correctly.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20061203204459481