[comp.lang.postscript] Help with Mac-generated PS files...

tcianflo@nugipsy.UUCP (Tom Cianflone) (03/29/88)

Our normal mode of operation is to produce text using troff,
with TransScript doing the troff to PostScript translation.
Output is produced on our DataProducts 2665 laser printer.
(This is a PostScript printer.) We produce graphics on the Mac
and paste them in mechanically.

We are trying to complete a test case here to show that
the drawings we have on the Mac can indeed be printed on
our DataProducts 2665 laser printer.  This test case will be
used to support our decision to purchase devps by Pipeline
Associates, which allows PostScript files to be sourced into
troff documents.  For us, this is a chance to finally do
electronic cut & paste.

Unfortunately, we can't seem to get the Mac-generated PostScript
files to do anything but *print* on the printer.  That is, the
printer looks at them as if they are something to print, not
something to *do*.

What we've done:

	Saved two versions of a MacDraw drawing, one with clover-F,
		one with clover-K.
	Uplinked these files to UNIX, using SmartCom II and
		xmodem.
	On UNIX, we translated ASCII carriage returns to newlines.

This gave us two files, one with the prologue, one without, both
of which were usable with the UNIX editors.  In the file with
the prologue, the vi editor says that one character is non-ASCII.
Haven't figured out the problem there yet.

In any case, we tried sending these files to the printer a few
different ways.  Queueing them through lpr -Pps (ps is our local
id for the printer) just gets them printed out like text.
We tried this one: cat filename > /dev/tty25 (the printer port)
with no success (no output at all).  We also tried cat-ing the
files and piping them to psif and pscomm, which are both low-level
filters used by TranScript.  This clocked up cpu time but never
produced output or terminated.

Next we tried some suggestions from folks like, for instance,
adding this line at the beginning of the files:
	serverdict begin 0 exitserver
And also adding the showpage command at the end.  Still nothing.

I tried to include all the pertinent details here.
Anyone have any other suggestions?  Remember, we are just trying
to show that we have all the pieces of the puzzle here already,
with the exception of devps to make life easy.

Thanks in advance...
-- 
=> Regards, Tom Cianflone @ Gould Computer Systems Division <=
=>   ...!{uunet,sun,pur-ee,brl-smoke}!gould!tcianflone      <=
=>    ...!ihnp4!{codas,allegra}!novavax!gould!tcianflone    <=
=> NOTE: Disregard header info. Email to above paths only.  <=

gae@osupyr.mast.ohio-state.edu (Gerald Edgar) (04/04/88)

In some cases, at least, the PS file must begin with the line

%! 

Three characters, the third one being a SPACE.  If your fiddling with
the file removed the space, you may get the file merely printed.

-- 
  Gerald A. Edgar                               TS1871@OHSTVMA.bitnet
  Department of Mathematics                     gae@osupyr.UUCP
  The Ohio State University  ...{akgua,gatech,ihnp4,ulysses}!cbosgd!osupyr!gae
  Columbus, OH 43210                            70715,1324  CompuServe

towfigh@phoenix.Princeton.EDU (Mark Towfigh) (04/04/88)

In article <993@nugipsy.UUCP> tcianflo@nugipsy.UUCP (Tom Cianflone) writes:
>
>Unfortunately, we can't seem to get the Mac-generated PostScript
>files to do anything but *print* on the printer.  That is, the
>printer looks at them as if they are something to print, not
>something to *do*.
>
>In any case, we tried sending these files to the printer a few
>different ways.  Queueing them through lpr -Pps (ps is our local
>id for the printer) just gets them printed out like text.
> [other attempts]

I just had to solve almost the exact same problem yesterday!  I was
trying to filter the PostScript through their filters like pscomm
and so on, very low-level things which you're not supposed to use
anyway.  Finally, after looking at every other man page reference, I
decided to dig up the 4.2BSD Line Printer Spooling Manual.  In this
manual, it directed me to /etc/printcap, which I had looked at
before.

In my earlier looking at the filters, I had also checked out a few
default PostScript files (like the one the system prints when there
is an error).  At the top of this, there was a %!, and I also found
reference to this in the man page for TRANSCRIPT.  Finally I
understood the answer staring me in the face:  I just had to put
that extra line at the top.  Now everything works fine, and yours
should too.

Boy, I hate little tricks like this.
-- 
Mark Towfigh       If there's one thing I like better than a bologna
                   and whipped cream sandwich, it's honey and ketchup.
=======================================================================
UUCP/Inet:         towfigh@phoenix.princeton.edu  BITNET:  TOWFIGH@PUCC

lyndon@ncc.UUCP (Lyndon Nerenberg) (04/05/88)

> In some cases, at least, the PS file must begin with the line
  
> %! 
  
> Three characters, the third one being a SPACE.  If your fiddling with
> the file removed the space, you may get the file merely printed.

Are you sure about this? What about %!PS-Adobe which is a documented
part of the encapsulation standard?

I have noticed that some software (Ventura 1.0 under MS-DOS for one)
outputs the header as ^D%! ...

The idea being to force an end-of-job before your file. This really
screwed us for the better part of a day - everytime we sent a Ventura
created file via the UNIX spooler (lpd and pscomm) we would get raw
PS source. It turns out pscomm.c was checking for "%!" to determine
if it was a PS file. The fix was to add a check for "\04%!" ...

-- 
lyndon  {alberta,uunet}!ncc!lyndon  lyndon%ncc@uunet.uu.net

cramer@optilink.UUCP (Clayton Cramer) (04/06/88)

> 
> In some cases, at least, the PS file must begin with the line
> 
> %! 
> 
> Three characters, the third one being a SPACE.  If your fiddling with
> the file removed the space, you may get the file merely printed.
> 
> -- 
>   Gerald A. Edgar                               TS1871@OHSTVMA.bitnet
>   Department of Mathematics                     gae@osupyr.UUCP
>   The Ohio State University  ...{akgua,gatech,ihnp4,ulysses}!cbosgd!osupyr!gae
>   Columbus, OH 43210                            70715,1324  CompuServe

I haven't found a PostScript printer yet that requires the %! header --
but there's a lot of other software out there that can get between
your application and the printer in a network that does expect that
header to identify a file as PostScript.  (This sometimes presents annoying
problems when you attempt to print out a PostScript file as ASCII).

Clayton E. Cramer

rce229@uxa.cso.uiuc.edu (04/06/88)

Others have answered your main question.  But the "non-ASCII character"
message you got from vi is probably due to the extra garbage (often nulls)
that the XMODEM protocol appends to received files (to round them in 128
byte increments).  They usually don't harm anything.

hurf@batcomputer.tn.cornell.edu (Hurf Sheldon) (04/14/88)

In article <136800002@uxa.cso.uiuc.edu> rce229@uxa.cso.uiuc.edu writes:
 Submitted here is a shell script lsmith created to handle files created
with command F and all the little bugs due to different versions of
laserprep, etc. We have been using it without a complaint for 6 mos or
more - you will have to put the appropriate laserprep files where you
want them and edit the script accordingly.
 Additional questions to lsmith@ionvax.tn.cornell.edu 
(don't be lazy and waste his time before you spend some time on it, please)
----------------------remove this line and all above---------------------
#!/bin/sh
echo '  Input is ' $# 'files.'
for FILE in $@
 do if test -r $FILE -a -s $FILE
   then if grep -s appledict $FILE
	then echo 'Please use MacPostscript files produced by CMD f, not CMD k.'
             echo 'The file' $FILE 'is not acceptable for printing'
	elif grep -s dobe-2.0 $FILE
		then echo 'Printing MacIntosh PostScript2.0 file' $FILE
		cat /usr/lib/mac/LaserPrep4.0.ps $FILE | lpr -Plsr

		elif grep -s dobe-1.0 $FILE
			then echo 'Printing Mac PostScript1.0 file' $FILE
			cat /usr/lib/mac/LaserPrep.ps $FILE | lpr -Plsr

	else echo 'The file,' $FILE ',does not appear to be a Macpostcript'
	     echo 'file, or the version of PS Adobe is not one we are set up to'
	     echo 'preprocess at this time. Please check your file.'
	     echo 'Do remember to Text(not Binary) Kermit postscript files'
	     echo 'when bringing them from the Mac to the Vaxes'
       fi
   else echo 'Usage: macpr <MacPostScript_File>. We do want a file, folks.'
  fi
  echo '     '
done
# macpr, by Lawrence Smith, 8/5/87 #
----------------------remove this line and all below to another file-----

						MACPR(1l)






NAME
       macpr - print a mac postscript file on the laserprinter

SYNTAX
       macpr file (file file ...)

DESCRIPTION
       macpr will take one or more PostScript files produced on a
       Macintosh, prepend the proper modified header file, and send 
       it to the LaserWriterPlus in 369 Upson. 

       macpr checks for keywords telling it what version of Adobe
       PostScript this file was intended to run on (currently 1.0 & 2.0)
       and rejects the file if it cannot find them. 

       If the file contains the proper keys, macpr will add the 
       1.0 or 2.0 header and send the job to the printer.

       +++++++++++++++NOTE: The Mac INCANTATION+++++++++++++++++++++++++

       Step 1. Lie to your Mac. Tell it that it is connected to a
	       LaserWriter, even if this means telling it that AppleTalk
	       is connected to the printer port. (But shut off the 
	       Imagewriter first.) This means:
	       A. having laserwriter and laserprep in the system folder
	       B. using the chooser to select the laserwriter 

       Step 2. Select PageSetup from the file menu, and choose settings
	       and features for this print job.

       Step 3. Select Print from the file menu, choose settings
	       from the resulting dialog box, and get ready to click
	       on OK. But do not do so yet.

       Step 4. While holding down the CMD (clover) key, click on OK and 
	       IMMEDIATELY press and hold the f key until a box comes up
	       with "Creating PostScript file". Then you may release
	       both keys and wait for it to finish. (You will probably
	       have to shut off any print spooler to make this work)

       Step 5. exit your application and look for the PostScript file.
	       If it is PostScript0, then you may create up to 10
	       files at once. If it is named PostScript, then you will
	       have to exit and change its name each time that you
	       create a PS file, or it will be overwritten.

       Step 6. Reset printer choice when done. Then twiddle something in
	       the control panel, which will save the chooser setting.
	       (yes, this is arcane. But it means using the printer
	       normally the next time you power up...)

       Step 7. Use VersaTerm to logon to ionvax, and issue the command
	       "kermit -r", which prepares ionvax's kermit to recieve
	       a file. On the Mac, select Text Kermit from the file menu.
	       
       Step 8. Select SendFile... from the file menu, select the file to
	       send, and click SendOne. The file will be copied into your 
	       current directory on ionvax with the name it has on the 
	       Mac.

       Step 9. macpr file    [on ionvax, of course...]

DIAGNOSTICS
       Complains about no file, file with LaserPrep header, files which
       are not Adobe-1.0 or Adobe-2.0, zero length file.

BUGS

FILES
     /usr/local/macpr, /usr/lib/mac/LaserPrep.ps, /usr/lib/mac/LaserPrep4.0.ps

SEE ALSO
     lpr(1), sh(1), lpq(1), kermit(1c), VersaTermPRO manual
                						    [8/5/87 -LS]
-- 
     Hurf Sheldon			 Network: hurf@ionvax.tn.cornell.edu
     Lab of Plasma Studies		  Bitnet: hurf@CRNLION
     369 Upson Hall, Cornell University, Ithaca, N.Y. 14853  ph:607 255 7267
     I sold my Elan, got a job in science; Now, no one takes me seriously.

sjordahl@megatest.UUCP (Scott Jordahl) (04/16/88)

In article <4407@batcomputer.tn.cornell.edu> hurf@tcgould.tn.cornell.edu 
(Hurf Sheldon) writes:
> Submitted here is a shell script lsmith created to handle files created
>with command F and all the little bugs due to different versions of
>laserprep, etc. ...

There seems to be a couple of important files missing:

>echo '  Input is ' $# 'files.'
>for FILE in $@
> do if test -r $FILE -a -s $FILE
>   then if grep -s appledict $FILE
>	then echo 'Please use MacPostscript files produced by CMD f, not CMD k.'
>             echo 'The file' $FILE 'is not acceptable for printing'
>	elif grep -s dobe-2.0 $FILE
>		then echo 'Printing MacIntosh PostScript2.0 file' $FILE
>		cat /usr/lib/mac/LaserPrep4.0.ps $FILE | lpr -Plsr
		    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>		elif grep -s dobe-1.0 $FILE
>			then echo 'Printing Mac PostScript1.0 file' $FILE
>			cat /usr/lib/mac/LaserPrep.ps $FILE | lpr -Plsr
and			    ^^^^^^^^^^^^^^^^^^^^^^^^^

Could the original poster please post these two (2) files.  This looks just
like the utility we've been looking for.

Thanks for the posting,

-- Scott

>-- 
>     Hurf Sheldon			 Network: hurf@ionvax.tn.cornell.edu
>     Lab of Plasma Studies		  Bitnet: hurf@CRNLION
>     369 Upson Hall, Cornell University, Ithaca, N.Y. 14853  ph:607 255 7267
>     I sold my Elan, got a job in science; Now, no one takes me seriously.


/########################################################################\
| Scott A. Jordahl							 |
| Megatest Corporation							 |
| UUCP:   {decwrl, sun, fortune, pyramid, ubvax, amd} !megatest!sjordahl |
| USMAIL: Megatest Corporation						 |
|	  880 Fox Lane							 |
|	  San Jose, Ca  95131						 |
| PHONE:  [408] 437-9700  x3489						 |
\########################################################################/