[comp.sys.mac.misc] Generating PostScript and other goodies.

ksbolduan@amherst.bitnet (12/01/90)

It's been a while since this was posted, so I thought I'd send it out again.

Enjoy,
Kevin Bolduan
KSBOLDUAN@AMHERST

---------------------------- cut here -----------------------------

The following information is condensed from earlier messages in
"generating-postscript.txt" and other sources.  Here are some of the
contributors:
	gillies@cs.uiuc.edu			Ray_Davison@cc.sfu.ca 
	dmg@mitre.mitre.org			Les_Ferch@mtsg.ubc.ca
	jhl%naif.span@vlsi.jpl.nasa.gov (Jay Lieske)
	Russ Evans <E_GS18%vaxa.nerc-murchison.ac.uk@nsfnet-relay.ac.uk>
	The Blue Adept <KSBOLDUAN%AMHERST.BITNET@cunyvm.cuny.edu>

-----------------  How to generate a postscript file ---------------

(1) THE ONETIME POSTSCRIPT GENERATOR

This is a fast way for people who generate postscript twice a year,
and can't modify the system software on their machine (e.g. lab machine)

Select "Chooser" from the Apple menu, and then tell it you have
appletalk hooked up (lie).  If you really are using appletalk, then
you will have problems if there is no laserwriter on the network.  In
this case, perhaps you will be forced to disconnect appletalk.

Select the LaserWriter (not the LaserWriter SC driver.)  Turn
Background Printing off if you are using MultiFinder.  Selecting the
LaseWriter This will cause small formatting changes in most word
processors, since the laserwriter has larger characters than the
Imagewriter or other printers.  They can easily ruin a well-formatted
resume.  Go to your word processor and correct the lines that have now
changed.  It is a good idea to leave the laserwriter selected all the
time, if possible, so your documents are created with these changes
already in place.

Get ready to print the document in the normal fashion.  When you see
the LaserWriter dialog, click on OK and immediately type and hold
either the "k" key or the "f" key. You must depress the key immediately
within the first 1-2 seconds AFTER the dialog disappears.  Do not use
command-F or command-K, as there might be problems in depressing the
key too soon after clicking OK on the dialog.  

If you get a message "looking for laserwriter", then you probably hit
the key too late.  In that case, try again; when the print dialog
comes up instead of clicking on the OK button, HOLD THE MOUSE DOWN
without releasing it.  Then at your leisure press the "f" or "k" key
and then FINALLY release the mouse.

You should see a file called Postscript0 appear in the current folder.
The next time you do it, if Postscript0 already exists, Postscript1
will be generated, etc.  When Postscript9 is generated, no further
files will be generated.

The difference between these commands is that "k" prepends the
contents of Laser Prep to your Postscript output; "f" does not.  

(2) THE WEEKEND POSTSCRIPT GENERATOR

This is for people who want to occasionally generate postscript, but
also want to occasionally print directly to an attached serial or
appletalk laserwriter.

We suggest you add "Disk File" box in the laserwriter dialogue.  It
turns out that every laserwriter icon since version 5.2 (v5.2) can
have this option [Yes, Dorothy, you can go back to Kansas].  One way
to accomplish this is to employ the MyPageSetup utility, available as:
	[sumex-aim.stanford.edu]<info-mac>util>mypagesetup13.hqx

Another way to accomplish this is via ResEdit:

    (a) Make a copy of the Laserwriter icon to fiddle with.

    (b) Using the latest version of ResEdit (v1.2 or later), open the copy
	and then open DITL #-8191.  Choose "Select Item Number" from the DITL
	menu, and enter number 22.  Close the Window and then choose "Open As
	Dialogue Item" from the File menu.  This should open a window
	describing a "Disk File" item, which has a bounding box of
	((0,0)(0,0)).  This box is all zeroes, which is why the "Disk File"
	checkbox is invisible.  Change it to something useful
	((49,314)(65,395)) and close the window.  The word "Disk File" should
	now appear in the dialogue box.  Drag it elsewhere to change
	the positioning.  Close ResEdit and save your changes.

Now, every time you print, you may select the checkbox in order to
generate a "Postscript0", "Postscript1", ... etc. file.  

(3) THE SERVICE-BUREAU USER

These people want to name the postscript file something similar to the
name of the original document; this helps them keep track of their
archived postscript files.

The following INIT adds a "Disk File" checkbox to the laserwriter
dialogue, and prompts the user to name the Postscript file directly,
when "Disk File" is turned on:
	[sumex-aim.stanford.edu]<info-mac>util>laser-fix-10.hqx

(4) THE IMPATIENT USER WITH NO LASERWRITER AT ALL

This is for people who never have access to a laserwriter from their
macintosh.  These people want a file named "Postscript0" on their disk
as fast as possible.  This file will be immediately uploaded & deleted
from the macintosh, so the name "Postscript0" perfectly acceptable.

It turns out the "Disk File" box will not stay ticked (so far as we
know), so we suggest you patch the laserwriter driver to ALWAYS
generate a postscript file.  Begin by making a spare copy of your
"Laserwriter" icon (because you can easily damage it permanently).
Then use ResEdit to make the following patches to the copy (note: you
will be editing a string of hex digits; do not change the length of
the string).

	     Resource PDEF number 125
	           location       From       To
Laserwriter     v5.2   v6.0
	         B96    C78       '57C0'    '51C0'
	         B9A    C7C       '56C0'    '50C0'
	         BA2    C84       '57C0'    '50C0'   ('51C0' for Laser Prep)
	         BAA    C8C       '57C1'    '51C1'   ('50C1' for Laser Prep)
	         BB8    C9A       '57C1'    '50C1'

Close ResEdit and save your changes.  Now, when printing, if you
select "OK" in the dialogue, a Postscript file will always be generated.

(5) THE USER WITH A DEDICATED COMPUTER + PRINTER ON HIS/HER SERIAL PORT.

This is for someone who has a workstation or mainframe listening to
the macintosh serial port.  This workstation or mainframe is connected
to a postscript printer.  The workstation or mainframe is running a
program ready to accept a postscript file and spool it to the printer.

..Awhile ago someone had a request for information on connecting a
LaserWriter to the serial port through a switch box. I had a similar
need. I have a Mac and a Unix box and wanted to use the printer on the
Unix box from the Mac.  I didn't want to spend the money for a
Kinetics box for just one Mac so I went the route of using command-F
to create a file, moving the file to Unix and using macps to print the
file. This was rather tedious.
 
I modified the LaserWriter driver as outlined below. The changes I made
were specifically designed to print over a serial connection from the Mac
to the Unix box, but may be useful to print to a serial connected LaserWriter.
 
Changes to the LaserWriter driver (versions 5.2 and 6.0)
 
  1) Duplicate the file and give it a useful name.
  2) Use ResEdit (or something similar) to make the following changes:
     - to simulate the pressing of command-F
 
	     Resource PDEF number 125
       (first always write to a "file")
           location       From       To
         v5.2   v6.0
         B96    C78       '57C0'    '51C0'
         B9A    C7C       '56C0'    '50C0'
         BA2    C84       '57C0'    '50C0'   ('51C0' for Laser Prep)
         BAA    C8C       '57C1'    '51C1'   ('50C1' for Laser Prep)
         BB8    C9A       '57C1'    '50C1'
          
       (next don't create a file (still in resource PDEF/125))
            location          From         To
          v5.2    v6.0    V5.2    V6.0
          D96     E9E    '554F'  '558F'   '6038'
     
       (next, don't do _SetEOF to empty said file)
            location          From        To
          v5.2    v6.0
          142C    1860       '660C'      '600C'
     
     - change the string in resource STR number -8159 to something more
       useful than "Creating PostScript File" (e.g. I used "Sending print
       job to NeXT").
 
     - set resource STR number -8191 to the name of the serial port you
       will use. ".BOut" for the printer port or ".AOut" for the modem port.
 
     - set resource PAPA number -8192 to the name of the printer if
        you want to.

  A couple of notes: the default settings for the serial ports are 9600 baud
  no parity. So far this has worked fine but I may try changing the speed.
  When you choose the driver with the Chooser, it will turn on AppleTalk. If
  you are using the printer port then you *must* turn AppleTalk back off
  before using the modified driver.
 

  On the Unix end: I modified macps to "break" instead of "continue" when
  it finds the string "%%EOF" and then the command
       macps < /dev/ttyb | lpr
  can be installed in a deamon that loops forever (modify /dev/ttyb to use
  whatever serial port on your Unix box you connected the Mac to).
 


----------------------- OTHER USEFUL INFORMATION -------------------------

(1) FORCING THE GENERATED FILE TO GO TO ONE DIRECTORY

Postscript files are normally stored in the folder of the application
that is currently running; If you have a telecom script (Red Ryder...)
that uploads your Postscript file, it may not find this file.  We
suggest you make the file go to a pre-specified folder on your hard
disk.  Edit you Laserwriter icon via ResEdit as follows:

	     Resource STR #-8191
		From		To

		"Postscript"	"HD40:Postscript"

This would put the file in the top-level directory of a hard disk
named "HD40".  Or if you just want all your files to go into a folder
named "Spool" on a disk named "HD40":

	     Resource STR #-8191
		From		To

		"Postscript"	"HD40:Spool:Postscript"

etc. etc. etc.

(2) WHAT TO DO WHEN YOU HAVE PROBLEMS PRINTING THE FILE ON A
NON-LASERWRITER

Apple's laserprep file crashes nearly all non-apple printers (Not
cool, apple).  Because of copyright law and lawyers, we can't just
give you a modified laser prep file.  Instead, we offer two ways to
get around this problem.  One, you can use a UNIX program ("prepfix")
that edits a laserprep file to fix the mistake.  Two, you could edit
the file yourself (it takes 5 minutes and a decent editing program).

METHOD 1.  These UNIX programs will (a) edit a Laserprep file for you,
and (b) concatenate an edited Laserprep file with a postscript file;
These programs are stored in
	[sumex-aim.stanford.edu]<info-mac>unix>macps-22.shar

This is a shar archive containing two programs.  The shar archive is
unpacked using the Bourne shell and provides various documentation and
build files as well as the two c programs -- prepfix and macps.  The
first processes the LaserPrep file produced by holding down <Apple+K>
whilst printing an empty file and transforms it into a prep file which
is acceptable to most Postscript printers.  The second, macps,
processes documents produced using the <Apple+F> key to include the
processed header file.  prepfix/macps allow for the possibility of
different versions of Apple's LaserPrep.  

METHOD 2.  Read the file 
	[sumex-aim.stanford.edu]<info-mac>tips>imagen-postscript.txt

This file tells you how to edit a laserprep file to work with most
printers (this isn't just for imagen printers, actually).  Note: Only
Apple printers have bitmap smoothing; this is not part of normal
postscript.  If you absolutely need bitmap smoothing, and your printer
has an MC68000-family processor, and you are using the laserwriter
v5.2 icon, consider downloading the following specially hand-modified
laserprep file:
	[sumex-aim.stanford.edu]<info-mac>misc>laserprep-65-postscript.txt.

This file SHOULD NOT be used with non-MC68000 printers; it contains
assembly-language code that could crash such printers.  

(3) YOU HAVE A POSTSCRIPT FILE ON YOUR MACINTOSH AND WANT TO GET IT TO
THE PRINTER --

A Postscript(R) file can be printed using three utilities: SendPS, a
free application from Adobe, archived in
	[sumex-aim.stanford.edu]<info-mac>util>sendps-121.hqx

Or use PS Printer, a free desk accessory; or Hyper PS, a Hypercard
stack for sending Postscript files to a Postscript printer.