[comp.sys.next] How do I print Mac PostScript on the NeXT Printer?

rock@lighthouse.com (Roger Rock Rosner) (09/18/89)

We would like to be able to print PostScript files generated by Mac
programs (like MacDraw and MacPaint) on our NeXT Printer.  Is there
any software out there to simulate the PostScript functions with which
Apple initializes printers?

Thanks,
Roger Rosner

Usenet:   ...!uunet!lighthouse!rock 
Internet: rock@lighthouse.com
US mail:  7100 Edgevale Street
          Chevy Chase, MD 20815-5906
Phone:    301-907-4621

ali@polya.Stanford.EDU (Ali T. Ozer) (09/19/89)

In article <1989Sep18.033423.7053@lighthouse.com> Roger Rock Rosner writes:
>We would like to be able to print PostScript files generated by Mac
>programs (like MacDraw and MacPaint) on our NeXT Printer.  Is there
>any software out there to simulate the PostScript functions with which
>Apple initializes printers?

I don't think so; however, getting rid of the initialization code
or defining those operators to do nothing might work just fine.

Some programs generate PostScript documents which have page-size
commands such as "letter" in the middle, rather than up front.
These documents do not print on the NeXT machine --- if you come
across such documents, you'll need to either get rid of the "letter"
(or "legal" or "note") command or bring it near the front, where it belongs.

Ali Ozer, NeXT Developer Support
aozer@NeXT.com

dorner@pequod.cso.uiuc.edu (Steve Dorner) (09/20/89)

In article <11843@polya.Stanford.EDU> aozer@NeXT.com (Ali Ozer) writes:
>In article <1989Sep18.033423.7053@lighthouse.com> Roger Rock Rosner writes:
>>Is there
>>any software out there to simulate the PostScript functions with which
>>Apple initializes printers?
>
>I don't think so; however, getting rid of the initialization code
>or defining those operators to do nothing might work just fine.

Unfortunately, the folks from Apple do several nasty things in their
PostScript.

1) They download 68000 code into the controller.
2) They do this in hex, no line breaks.
3) They use returns, not newlines.
4) They use operators defined only in laserwriters.
5) They speak entirely their own dialect of PostScript; the apple
dictionary MUST be present.

Fortunately, this is all easy to fix.  Generate your Mac PostScript file
with CMD-K, to include apple's dictionary.  Move it to your NeXT; for
sake of argument, call it mac.ps.  Now, give the following command:

tr '\015' '\012' <mac.ps | sed -f fix.sed | lpr

I provide "fix.sed" below, which I know to work for the LaserPrep from
Mac System 6.0.2.

Note that there are more efficient variations on this theme; this is
just one simple way to do it.  The best way, if you have a kinetics or
gator box, is to use CAP.  You still have to diddle Apple's laserprep,
but the result is that you can "see" the NeXT's printer in the Macintosh
"Chooser".  

--- cut here for fix.sed ---
1i\
%!PS-Adobe-2.0
402,421d
82,83d
20,24c\
/ok true def\
/LW false def\
/waittimeout 300 def\
/fc {} def
8,18d
--- end of fix.sed ---
-- 
Steve Dorner, U of Illinois Computing Services Office
Internet: s-dorner@uiuc.edu  UUCP: {convex,uunet}!uiucuxc!dorner
IfUMust:  (217) 244-1765

greid@adobe.com (Glenn Reid) (09/20/89)

In article <1989Sep18.033423.7053@lighthouse.com> Roger Rock Rosner writes:
>We would like to be able to print PostScript files generated by Mac
>programs (like MacDraw and MacPaint) on our NeXT Printer.  Is there
>any software out there to simulate the PostScript functions with which
>Apple initializes printers?

I don't know how well these will work for you, but I hacked up the
following "simulations" of some LaserWriter built-in features so
that I could work with Mac-generated PostScript files on my Display
PostScript work-brew system (it's not a NeXT, but it is Display
PostScript).  I forget which version of LaserPrep this was written
to defend itself against; give it a try:

%%BeginProcSet: preview_compat 1.0 0
% Glenn's previewer compatibility package
% things have been added as problems are discovered

/statusdict where { pop }{ /statusdict 20 dict def } ifelse
statusdict begin
    /waittimeout 600 def
    /setjobtimeout /pop load def
    /printername { (Sun 3/50) } def
    /setsccinteractive /pop load def
    /pagecount 0 def
end

/product (NeXT) def		% modified for posting to net
/letter {} def
/legal {} def

% the following hack fools the Mac LaserPrep file into
% flushing only as far as the next comment, not through EOF:

/*buff 1 string def
/*flushfile /flushfile load def
/flushfile { %def
    % userdict exch /*currfile exch put
    { %loop
	dup *buff readstring {
	    0 get (%) 0 get eq { pop exit } if
	} if
    } loop
} bind def


/serverdict where { pop }{ %ifelse
    /serverdict 10 dict def
    serverdict begin
	/exitserver {
	    (%%[Exitserver: something weird will probably happen.]%%) = flush
	    pop	% password
	    end % serverdict
	} def
	/setrealdevice {} def
	/execjob { exec } def
    end
} ifelse

% not necessary unless there is no default clipping path defined in the
% device installation:

/*initgraphics /initgraphics load def
/initgraphics {
    *initgraphics initclip
    newpath 0 0 moveto 612 0 rlineto 0 792 rlineto -612 0 rlineto closepath
    clip newpath
} bind def

initgraphics mark clippath {}{}{}{} pathforall counttomark 0 eq { %if
    /clippath { %def
	0 0 moveto 612 0 rlineto 0 792 rlineto -612 0 rlineto closepath
    } bind def
} if
cleartomark newpath

%%EndProcSet

space@ncc1701.UUCP (Lars Soltau) (09/20/89)

In article <11843@polya.Stanford.EDU> ali@polya.Stanford.EDU (Ali T. Ozer) writes:
>In article <1989Sep18.033423.7053@lighthouse.com> Roger Rock Rosner writes:
>>We would like to be able to print PostScript files generated by Mac
>>programs (like MacDraw and MacPaint) on our NeXT Printer.  Is there
>>any software out there to simulate the PostScript functions with which
>>Apple initializes printers?
>
>I don't think so; however, getting rid of the initialization code
>or defining those operators to do nothing might work just fine.
>
>Ali Ozer, NeXT Developer Support
>aozer@NeXT.com

Say, I've heard that the NeXT PostScript license only permits printing of
documents generated on the NeXT itself on a NeXT laser printer.
So, is it illegal to upload Mac generated PS docs to the NeXT and use the
NeXT laser printer with its better resolution to print them? I'd sure like
to hear that it isn't. :-)

Why I'm at it, is there any chance that NeXT will extend its University
sponsor program to European universities? If not, will I as a European
(German) student be able to purchase one directly from NeXT? If so, what
address should I write to? What is the meaning of live, the universe and
everything? :-)

--
Lars Soltau     uucp: ...uunet!unido!nadia!ncc1701!space    BIX: no bucks

feldman@umd5.umd.edu (Mark Feldman) (09/21/89)

In article <101@ncc1701.UUCP> space@ncc1701.UUCP (Lars Soltau) writes:
...
>
>Say, I've heard that the NeXT PostScript license only permits printing of
>documents generated on the NeXT itself on a NeXT laser printer.
>So, is it illegal to upload Mac generated PS docs to the NeXT and use the
>NeXT laser printer with its better resolution to print them? I'd sure like
>to hear that it isn't. :-)

The only limitation that has ever been placed on the NeXT Window Server (the
Display PostScript engine) was that the final bitstreams/images generated by
the window server and sent to the MegaPixel Display (92dpi) or the printer
(300/400 dpi) could only be used on NeXT equipment (Hmmm... I wonder how
projectors fit into this scheme).  This is the device-dependent stuff that
the window server generated from your PostScript.  There has never been a
limitation on importing or exporting PostScript.  This requirement was part
of the shrink-wrap license agreement under release 0.8 and was documented in
the "Read this first!" manual.  

Here is the actual text from that manual:

	...
	The Next Preliminary Software is intended to be used to generate
	screen displays with resolutions of 92 dots per inch on a NeXT
	Computer and to print imahes with print resolutions of up to 400
	dots per inch on a NeXT Printer.  You agree not to make use of the
	NeXT Preliminary Software, directly or indirectly, to print bitmap
	images generated by the NeXT Preliminary Software, or to generate
	fonts or typefaces, other than on a single NeXT Computer in
	conjunction with a single NeXT Printer.
	...

No mention of PostScript.  The NeXT model, which fits in with the above
restriction, is that the PostScript language is used to manipulate images
every which way (on the same NeXT, to another NeXT, to or from another type
of computer or printer...), but the PostScript to device dependent
translation and subsequent bitmaps are limited to the NeXT devices on the
NeXT on which the translation is done.  Phew.

I haven't seen anything similar in the 0.9 or 1.0 documentation, though I
may not have looked hard enough.  NeXT heard a fair amount on this subject
the first time it was brought up back in the old days of 0.8.  Many people
argued that such a shrink-wrap requirement was absurd, not to mention
unproven in the courts.  The argument was that as long as you follow the
copyright laws, NeXT (or anyone else) can not (and should not try to)
prevent you from using their product in any way you see fit.

	Mark

rkpc@mergvax (Rob Kedoin) (09/26/89)

In article <1989Sep19.183019.991@ux1.cso.uiuc.edu>, dorner@pequod.cso.uiuc.edu (Steve Dorner) writes:
> In article <11843@polya.Stanford.EDU> aozer@NeXT.com (Ali Ozer) writes:
> >In article <1989Sep18.033423.7053@lighthouse.com> Roger Rock Rosner writes:
> >>Is there
> >>any software out there to simulate the PostScript functions with which
> >>Apple initializes printers?
> >

There are a pair of programs available on sumex-aim.stanford.edu (sorry, I
can't remember the file path) called "macps" and "prepfix".

The ReadMe file included below explains the operation of the software.  The
ReadMe also indicates that it should work for NeXT systems.

		-Rob Kedoin

UUCP:   {decvax, motown, cpmain, icus}!mergvax.uucp!rkpc
ARPA:	rkpc%mergvax.UUCP@decvax.dec.com
USMail: Linotype Company - R&D 425 Oser Avenue Hauppauge, NY 11788
VOICE:	(516) 434 - 2729
FAX:	(516) 434 - 2072


---
COPYRIGHT NOTICE (SCCSid = "@(#)ReadMe	2.1 3/29/89")

Copyright (c) 1988, The Regents of the University of California.
Edward Moy, Workstation Software Support Group, Workstation Support
Serices, Information Systems and Technology.

Permission is granted to any individual or institution to use, copy, or
redistribute this software so long as it is not sold for profit,
provided that this notice and the original copyright notices are
retained.  The University of California makes no representations about
the suitability of this software for any purpose.  It is provided "as
is" without express or implied warranty.

WHAT IS MACPS?

Macps is a Unix program that takes an uploaded PostScript file created
on a Macintosh (by typing Command-F at the LaserWriter dialog box; see
macps.1 for more details) and includes an appropriately modified
LaserPrep file so that the result can be sent to a PostScript printer
>From Unix.  The LaserPrep file contains macros used by the PostScript
generator on the Macintosh.

WHY IS MACPS NEEDED?

This is how Mac printing works.  When a Mac talks to a LaserWriter, it
asks if the LaserWriter has had a LaserPrep file downloaded to it.  A
LaserWriter that is first powered up, has no such LaserPrep file, and
so the Mac downloads it and makes the LaserPrep file resident in
memory.  Then the actual print file is sent to the LaserWriter.
Subsequent print requests need not download the LaserPrep file, unless
it is a different version.

Since a LaserWriter connected to a Unix system usually does things
other than Mac printing, it is unwise to make LaserPrep files resident
in memory so that other PostScript jobs have less memory to work with.
What prepfix does is to modify a LaserPrep file so that, among other
things, it does not make itself resident in memory.  Thus, the
LaserPrep file must be downloaded for each Mac print job.  This is the
function of macps, to automatically append the appropriate LaserPrep
file.

WHICH VERSION OF THE LASERPREP WILL BE USED?

Macps interprets the %%IncludeProcSet directive found in the PostScript
generated by LaserWriter driver 4.0 and greater.  It takes the ProcSet
id and looks it up in a file "macps.config", to get the pathname of the
prep file, and thus macps can convert PostScript generated by different
versions of the LaserWriter driver.

HOW ARE THE LASERPREP FILES GENERATED?

Since the Apple LaserPrep files are copyrighted, I've included a
program, prepfix, that reads version 4.0 and up LaserPrep files, and
edits them so that they are compatible with Unix, and are even
electronically mailable (See prepfix.1 for more details).

WHERE IS THE MACPS.CONFIG FILE LOCATED?

Macps has some special code that is able to figure out from which
directory it was called from.  It will then look in a "lib" subdiretory
for the macps.config file.

WHAT ABOUT BIT-SMOOTHING ON NON-LASERWRITER PRINTERS?

For PostScript printers using Motorola 680x0 processors and Adobe
PostScript firmware other than LaserWriters, there is an option that
will allow these printers to do bit-smoothing, just like LaserWriters.

CHANGES IN VERSION 2.1

Version 2.1 of prepfix uses a safer method for turning on bit-smoothing
for non-Apple printers.  This should get around some of the problems
people have been having with specialized macros in the LaserPreps that
are Apple printer specific.  The -l and -p options in version 1.1 have
been replaced with the single -l option, and the limit on the number
of printers you can specify has been removed.

Also, prepfix removes some other various macros that cause
unpredictable problems, and a problem with Apple LaserWriter II/NTs
(but not other Apple printers).

Version 2.1 macps has several new options.  The -c option allow you to
specify the number of copies to generate (overriding any multiple copy
option that was specified on the Macintosh).  The -d option allows an
alternate directory to look for the macps.config file.  Finally, the -r
(raw) option suppresses the conversion of 8-bit binary into ASCII, and
is useful for some graphics programs that manipulate gray-scale images,
and produce 8-bit binary PostScript output.

Macps will even work with a NeXT laser printer, but (at least the 0.8
version of the operating system) will not do bit smoothing.  Beware,
though, that if you print Macintosh patterns at 400 dpi, they will
look funny.

gelphman@adobe.COM (David Gelphman) (09/30/89)

In article <1221@adobe.UUCP> greid@adobe.COM (Glenn Reid) writes:
>In article <1989Sep18.033423.7053@lighthouse.com> Roger Rock Rosner writes:
>>We would like to be able to print PostScript files generated by Mac
>>programs (like MacDraw and MacPaint) on our NeXT Printer.  Is there
>>any software out there to simulate the PostScript functions with which
>>Apple initializes printers?
>
>I don't know how well these will work for you, but I hacked up the
>following "simulations" of some LaserWriter built-in features so
>that I could work with Mac-generated PostScript files on my Display
>PostScript work-brew system (it's not a NeXT, but it is Display
>PostScript).  I forget which version of LaserPrep this was written
>to defend itself against; give it a try:
   Users of the Macintosh who wish to move the PostScript files generated
by the LaserWriter driver will benefit greatly by using the lastest
version of the LaserWriter driver, version 6.0. I've been able to
use 'command-k' generated files from that version of the driver directly
in Display PostScript environments, although I haven't tried it on the
NeXT machine. 
   Regarding the use of carriage returns instead of linefeed characters:
this is perfectly acceptable in the PostScript language. Newline characters
are not required to be linefeeds: cr, lf, and crlf are acceptable newline
characters to the PostScript interpreter.

David Gelphman
Adobe Systems Incorporated