[comp.sys.mac.programmer] Mac PS Printouts via Sun Unix

aberg@math.rutgers.edu (Hans Aberg) (03/02/89)

The old Sun UNIX system used to have a Mac PostScript printout filter 
[ lpr -M ], but the new OS doesn't.

Now, one would expect any PS file print on any PS printer (with the
usual exceptions, custom PS commands etc.)

Does anybody know why this filter is needed? What is the difference
between the Mac PS files, and other PS files. (Regular PS files do
print out. The Mac files are created using cmd-F; the cmd-K produces
a prep directory, that wedges the printer.)

Hans Aberg, Mathematics
aberg@math.rutgers.edu

aberg@math.rutgers.edu (Hans Aberg) (03/02/89)

(This is a repost, due to a possible postnews bug.)

The old Sun UNIX system used to have a Mac PostScript printout filter
[ lpr -M ], but the new OS doesn't.

Now, one would expect any PS file print on any PS printer (with the
usual exceptions, custom PS commands etc.)

Does anybody know why this filter is needed? What is the difference
between the Mac PS files, and other PS files. (Regular PS files do
print out. The Mac files are created using cmd-F; the cmd-K produces
a prep directory, that wedges the printer.)

Hans Aberg, Mathematics
aberg@math.rutgers.edu

greid@adobe.com (Glenn Reid) (03/03/89)

In article <Mar.1.12.08.45.1989.8598@math.rutgers.edu> aberg@math.rutgers.edu (Hans Aberg) writes:
>
>The old Sun UNIX system used to have a Mac PostScript printout filter 
>[ lpr -M ], but the new OS doesn't.
>
>Now, one would expect any PS file print on any PS printer (with the
>usual exceptions, custom PS commands etc.)
>
>Does anybody know why this filter is needed? What is the difference
>between the Mac PS files, and other PS files. (Regular PS files do
>print out. The Mac files are created using cmd-F; the cmd-K produces
>a prep directory, that wedges the printer.)

The PostScript language code written by the Apple Printing Manager is
device-dependent as well as environment-dependent.  You cannot simply
upload command-F or command-K files and expect them to print without
alteration from another host (very unfortunately).  Of course, those
command keys are undocumented, I think, so they aren't guaranteed to be
good for anything other than looking at the code.  Each release of the
system software usually requires slightly different things to be
removed from it, so "lpr -M" would require quite a bit of maintenance.

perry@key.COM (Peter Kiehtreiber) (03/03/89)

[If you aren't interested in printing Mac PostScript files under UNIX, you
 can hit 'n' now.]

In article <Mar.1.12.29.22.1989.8842@math.rutgers.edu> aberg@math.rutgers.edu (Hans Aberg) writes:
> The old Sun UNIX system used to have a Mac PostScript printout filter
> [ lpr -M ], but the new OS doesn't.
> Now, one would expect any PS file print on any PS printer (with the
> usual exceptions, custom PS commands etc.)
> Does anybody know why this filter is needed? What is the difference
> between the Mac PS files, and other PS files. (Regular PS files do
> print out. The Mac files are created using cmd-F; the cmd-K produces
> a prep directory, that wedges the printer.)
> Hans Aberg, Mathematics
> aberg@math.rutgers.edu

I don't know of (or remember) a "-M" option to lpr. Was it really a
Mac-specific option, or just "generic PostScript"? If it was, it probably
did what I describe below.

The reason why the output of cmd-K "wedges" the printer is that the
Apple LaserPrep file tries to do rather intrusive things to the printer.
(I think it actually tries to download MC68000 code to the printer engine,
but don't quote me on that. In any case it tries to make permanent
modifications in the LaserWriter's memory, a definite no-no in a shared
environment). The TranScript system, being in a multi-user environment,
"locks" the printer against such blatant intrusions. If you check the spool
directory for your printer (/usr/spool/<printername>), you'll find an error
message in the log file (lw-log), usually "InvalidAccess"; the printer
then proceeds to ignore your job.
On the other hand, a file produced by cmd-F relies on the LaserPrep file
having been sent to the printer before, so this won't work either.

So what's a user to do?

What I do (Sun 3/280, SunOS3.5, LaserWriter II NT), is use a modified
LaserPrep file. I keep that file here on the Sun, and pre-prend it to any
PostScript output I want to print (produced with cmd-F). To be exact:
	#!/bin/sh
	LASERPREP=/whereever/you/keep/the/modified/copy/of/LaserPrep
	(cat $LASERPREP $*) | lpr -P<printername>
Well, you get the picture.

The change to the LaserPrep file isn't all that bad. It mainly consists of
deleting the offending commands at the start of the file, and verifying that
it still works afterwards. A simple trial-and-error job. For your convenience,
here's a diff beween the original (System 6.0.2/3) and my version:

1d0
< %!
8a8,14
> statusdict begin waittimeout 300 lt{0 60 300 setdefaulttimeouts}if end
> currentfile statusdict begin serverdict begin product (LaserWriter II NT) eq revision 1 eq and {/setrealdevice {//setrealdevice exec 31 sendpcmd 4 eq tonerlight} bind def
> /execjob {31 sendpcmd 4 eq tonerlight //execjob exec} bind def end end eexec}{end end 722{currentfile read pop pop}repeat}ifelse 
> 35de8eabfc7fa...
> d27489a69d6b6... (long lines truncated here)
> 7b1c0b5203cfc...
> 6eb9e36ec45ba...
17a24
> ok{statusdict begin 9 sccinteractive 3 ne exch 0 ne or{9 0 3 setsccinteractive}if end}if

In clear text: delete lines 8-14 and 24, and add "%!" as the first line.
(You should visually inspect your LaserPrep file to make sure your file
matches the contents shown.)

I hope this helps. Works without a hitch for me, anyway. Have fun!
  -- perry
-- 
------------------------------------------------------------------------
Perry The Cynic (Peter Kiehtreiber)		     perry@arkon.key.com
** What good signature isn't taken yet? **	   ...!pacbell!key!perry