Sharing a printer with UNIX machines

Apr 10, '03 10:19:00AM

Contributed by: shellac

Here's the situation: I have a Mac OS X box on a network with a printer. Everything works fine. I share this printer happily with other Mac OS X systems. But printing from Debian causes problems. The first steps are well known, so I won't dwell on them. Install the cups-client software on the UNIX box, and edit /etc -> cups -> client.conf so it has:

ServerName <OS X Print Server>
DefaultPrinter <Printer Name>
In my case the printer name was Lexmark_Z25_Z35. You should now be able to execute:
lpr <text file>
But there is a problem. Most UNIX apps (eg Mozilla) will send PostScript, but the OS X print system is PDF based, and will essentially send the print job to /dev/null because it can't change the input to PDF. This is where I was stuck. The UNIX people had to save the print job to a file, then use ps2pdf to convert it before sending, or change the print command in each app. Annoying, and I couldn't find a solution anywhere.

Well I managed it myself. First get epspgs from Gimp-Print, or install it via fink. This will give you the ps2pdf tool. Next create pspdffilter in /usr -> libexec -> cups -> filter, and paste these contents:
#!/bin/sh

export PATH=$PATH:/usr/local/bin
PS2PDF=ps2pdf

if test "x$6" == "x"
then
  exec $PS2PDF - -
fi

exec $PS2PDF $6 -
You'll need to change the path if you used fink. Save and make this file executable, i.e. chmod a+x pspdffilter. Now create the file ps2pdf.convs in /etc -> cups:
application/postscript    application/pdf 33 pspdffilter
And finally, killall -HUP cupsd. It should now work. It needs some refinement, specifically logging and page accounting (see writing cups filters for more information), but I'm happy!

[robg adds: I have not tested this one...]

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030409085018342