lpr in Tiger: What Has Changed?

In Panther, I used the following script handler to output PostScript files:

on outputPS(psFiles, printerName)
	set psFiles to coercePathList(psFiles, "POSIX")
	if class of psFiles is list then set psFiles to listToTextForShell(psFiles, " ")
	set lprCommand to "lpr " & "-P " & quoted form of printerName & " -l " & psFiles as text
	do shell script lprCommand
end outputPS

This doesn’t work in Tiger (10.4.4; never tested in earlier versions of 10.4). I get the following error message:

lpr: error - unable to print file: client-error-not-found

I’ve checked the string it’s using for the do shell script command and it still conforms to what I find on the lpr man page. The printer’s name it’s being sent is correct, as far as I know. Following is an example string being sent:

“lpr -P ‘Phoenix2000MP-XNT’ -l ‘/Volumes/server/acct/job/pdf-ps/pms4727.ps’ ‘/Volumes/server/acct/job/pdf-ps/white4727.ps’”

Any help will be greatly appreciated.

Joseph:

I had a similiar issue when I upgraded, but it does not look like yours is the same. Anyway, my problem boiled down to the printer name string. In my 10.3 script, this worked:

set print_er to "Deskjet 5400 series"

I had to change it to this for the same script to work in 10.4:

set print_er to "Deskjet_5400_series"

Go to your terminal and run lpstat. That should return a list of printer names in the string format recognizable by the lpr shell script.

Good luck,

That did it. Thanks.

Now I just have to adapt the few scripts that use lpr to convert the printer names. Do you happen to know what it replaces besides spaces and dashes?

Should be lpstat -p to get a printer listing (at least on my Tiger machine)

In an AppleScript:

set P to paragraphs of (do shell script "lpstat -p")
set Ptrs to {}
repeat with aP in P
	set end of Ptrs to word 2 of contents of aP
end repeat
Ptrs

Weird, it’s lpstat -a on mine.

You guys should try lpstat -t. :cool:

Actually they all work for me: -p, -a, and -t. lpstat by itself returns jobs waiting if there are any, but nothing for me otherwise.
(10.4.4)