psroff

Dan Whipple pswhip at vogon.lerc.nasa.gov
Thu Nov 29 06:23:00 AEST 1990


    Some recent info that may be useful for the net. This was discovered
while developing some PostScript applications for our SGI systems
using the Laser Printer Support (Transcript).


1) Releases prior to 3.3 would create printer classes when using mknetpr and
   mkPS. Since all of our Transcript systems had directly connected printers
   we had no problems. After receiving some new systems which had Transcript
   but no printer we used mknetpr to create a networked printer. Two results-
   no NetClass and psroff failed to find a printer since it looks for a
   class called PostScript (if the environment variable LPDEST is not set).
   The lack of NetClass was not a problem but the lack of PostScript was.

   Our solution was to manuallly create the PostScript class using lpadmin
   so those systems with Transcript but no directly connected printer would
   work with psroff.


2) It was desired to use the troff .cf capability to include partial or
   full PostScript files in the output. The documentation discusses using
   the PB and PE constructs to surround the included text along with the
   % and . escapes for included text. After much experimentation the
   setup which really works was discovered. The file to be included (the
   argument to .cf) is expected to contain both the escape codes and the
   PB/PE constructs. Thus if troff sees the following:

         .cf yourfile

   then yourfile should contain

         %
         PB
         ....your stuff...
         PE
         .

    The % and . tell psdit to pass the included lines unchanged. The PB/PE
    constructs save and restore the printer state. Additionally PB returns
    to the default PostScript scaling and puts the origin at the current
    position. The cute part is that .cf outputs some stuff to force the 
    current position and font and size so if the escapes and/or PB/PE
    are external to the file there is a mishmash of ditroff and PostScript
    stuff output.
 
    However since it was necessary to add some other PostScript commands
    and undesireable to have to prepend and postpend stuff to every
    included file the following troff sequence was developed


    .....
    .cf /dev/null
    \!%
    \!PB
      ...desired PostScript with \! prefix...
    \!/!PS {}def
    \!/!PS-Adobe-1.0 {} def
    \!.
    .cf yourfile
    \!PE
    \!.


    The first .cf forces troff to output its stuff and set the PostScript
    state where it should be. Then the extra PostScript setup is performed.
    The second .cf does a normal file insert (see CAUTION below) which
    is followed by PE and the . to tell psdit to get back to normal.

    CAUTION: this setup must have the first character in the included file
    be a % so psdit is put into transparent mode after troff outputs its
    current position stuff. Since most of our files to be included
    are really EPS files the first line has this. The defs before the
    second .cf define what is left on the first line as a null function.

    This was actually all put into a troff macro for including PostScript
    files in troff output.



--
|------------------------------------------------------------------|
|  Dan Whipple                       Never lose your ignorance     |
|  NASA-Lewis Research Center          you can't replace it !      |
|  Mail Stop 5-11                                                  |
|  Cleveland, Ohio 44135                                           |
|  (216) 433-5859   FTS 297-5859                                   |
|  pswhip at avelon.lerc.nasa.gov       whipple at prandtl.nas.nasa.gov  |
|------------------------------------------------------------------|



More information about the Comp.sys.sgi mailing list