[comp.windows.ms] Printing Uploaded Windows Postscript files from Unix 4.3bsd??

sal@grip.cis.upenn.edu (Marcos Salganicoff) (04/19/91)

I am using the printer driver "Postscript File" from windows to
generate a postscript file on disk from a windows application on a pc.
Then I upload the postscript file to a unix system via kermit and try
to "lpr" it onto an apple laserwriter, which promptly flashes and gives
up.

With the macintosh there are laserprep files which must be prepended
to any file in order for it to print out. I imagine there is a similar
"prep" file for windows, right? My questions:

1.Is there any way to get windows to include the prep file (if it
doesn't) in the postscript when the ps file is generated, or does the
printer handler take care of it?

2.Is there are program which runs under unix which will automatically prepend
the windows "prep" file?

If anyone has done this, could you please let me know the procedure.
Thanks bunches,




			  Marcos Salganicoff
	  General Robotics and Active Sensory Perception Lab

sal@grip.cis.upenn.edu (Marcos Salganicoff) (04/20/91)

As an update to my own posting: I ran the postscript output file
through and X postscript previewer (after commenting out Laserwriter
specific stuff like "statusdict") and found that the problem was that
the windows ps driver was dropping spaces between keywords causing the
interpreter to bomb out. After hand inserting the appropriate spaces
the thing prints out just fine. Also don't forget to delete the ctrl-d
at the beginning and end of the file.

Marcos Salganicoff
General Robotics and Active Sensory Perception Lab
The University of Pennsylvania
Philadelphia, PA (USA)

c60c-2ij@web-2b.berkeley.edu (04/20/91)

In article <41541@netnews.upenn.edu> sal@grip.cis.upenn.edu (Marcos Salganicoff) writes:
>I am using the printer driver "Postscript File" from windows to
>generate a postscript file on disk from a windows application on a pc.
>Then I upload the postscript file to a unix system via kermit and try
>to "lpr" it onto an apple laserwriter, which promptly flashes and gives
>up.
>
>With the macintosh there are laserprep files which must be prepended
>to any file in order for it to print out. I imagine there is a similar
>"prep" file for windows, right? My questions:
>
>1.Is there any way to get windows to include the prep file (if it
>doesn't) in the postscript when the ps file is generated, or does the
>printer handler take care of it?
>
>2.Is there are program which runs under unix which will automatically prepend
>the windows "prep" file?
>
>If anyone has done this, could you please let me know the procedure.
>Thanks bunches,
>
>
>
>
>			  Marcos Salganicoff
>	  General Robotics and Active Sensory Perception Lab


If anybody has  any answer to this, please  forward the mail to me or
post it to the net. I generated an .EPS file from WfW and was able to 
print it on a PC connected  to a PosatScript Printer without windows 
by executing the following set of commands:
           copy /b header.eps lpt1:
	   copy /b word.eps   lpt1:

I uploaded  both the files on a Unix system (both as text and binary)
but when  I tried to "lpr" the header file, the printer spot out a 
page with a line  "Error in binary file" printed on that page. 

wer5@ellis.uchicago.edu (Will E. Rose) (04/21/91)

Here's the story:

First off, Windows puts a ^D at the start of a file, and Unix chokes on this,
as well as any ^D in the file.  It must be deleted.  Also, the first line
must be a %! all alone (Apple seems to prefer it that way).

We have written a small program that will play this little game for you.
It will run under Unix or DOS.

Individuals may feel free to use this program.  _ANY_ organization or 
institution must contact the authors first at wer5@midway.uchicago.edu.

Questions/comments to me.

					Will E. Rose

					User Support Chair
					University of Chicago
					    Computing Organizations
					Academic and Public Computing

					wer5@midway.uchicago.edu

Here's the code:

/* PSFIX - Will patch a postscript file for proper printing by
	   adding '%!' at the top of the file, and by eliminating
	   any nulls and control-d's in the file.

	   This patching is necessary when printing to Apple Print
	   Servers via LocalTalk, or when printing postscript to a
	   file from MicroSoft Windows 3.0.

   Authors:

   Amish S. Dave    and         Will E. Rose

   User Support                 User Support Chair
   University of Chicago        University of Chicago
    Computing Organizations      Computing Organizations

                                GSB Computing Services

    asd2@midway.uchicago.edu    wer5@midway.uchicago.edu
                                wer5@gsbsun.uchicago.edu               */

/* This program is copyrighted by the authors.  It may be distributed in
   its unmodified form among individuals.  Permission must be obtained
   for use by corporations or organizations of any kind, including
   educational institutions, from the authors.
   Contact: wer5@midway.uchicago.edu                                   */ 


#include <stdio.h>

main (argc, argv)
int  argc;
char *argv[];
{
FILE *in, *out;
int c;
int c1,c2,c3;

if (argc != 3)
  {
    fprintf (stderr, "Improper command syntax:\n");
    fprintf (stderr, "Proper Entry: psfix infile outfile\n");
    exit (1);
  }

if ( (in = fopen (argv[1], "r")) == (FILE *) NULL)
   printf ("Couldn't open %s for reading.\n", argv[1]);
else if ( (out = fopen (argv[2], "w")) == (FILE *) NULL )
   printf ("Couldn't open %s for writing.\n", argv[2]);
else
{
  c1 = getc (in);
  c2 = getc (in);
  c3 = getc (in);
  if (c1 != (int) '%' || c2 != (int) '!' || c3 != (int) '\n')
    {
      putc ('%',out);
      putc ('!',out);
      putc ('\n',out);
    }
  if (c1 != 0 && c1 != 4) putc (c1,out);
  putc (c2,out);
  putc (c3,out);
  while ( (c = getc (in)) != EOF )
    {
      if (c != 0 && c != 4) putc (c,out);
    }
  fclose (in);
  fclose (out);
  printf ("%s has been fixed and saved as %s.\n",argv[1],argv[2]);
        exit (0);
}
}

timur@seas.gwu.edu (The Time Traveler) (04/21/91)

In article <41541@netnews.upenn.edu> sal@grip.cis.upenn.edu (Marcos Salganicoff) writes:
>I am using the printer driver "Postscript File" from windows to
>generate a postscript file on disk from a windows application on a pc.
>Then I upload the postscript file to a unix system via kermit and try
>to "lpr" it onto an apple laserwriter, which promptly flashes and gives
>up.
>
>With the macintosh there are laserprep files which must be prepended
>to any file in order for it to print out. I imagine there is a similar
>"prep" file for windows, right? My questions:
>
>1.Is there any way to get windows to include the prep file (if it
>doesn't) in the postscript when the ps file is generated, or does the
>printer handler take care of it?
>

Correct.  However, this is automatically done whenever you print, unless
you turn the option off.  The keyword you're looking for is "Header",
which can be inclucded/ignored unter the Postscript setup option under
Control Panel / Printers.  You want it on.  It might be possible to 
print the header separately and never again, but I haven't gotten that
to work on our system.

>2.Is there are program which runs under unix which will automatically prepend
>the windows "prep" file?

Nope.  Like I said, it's Windows thing.  You have to send the file in raw
mode thought (on our system, it's "lp -oraw").  Our system can detect
a postscript file and switch to raw mode automatically, unless it's a
strange postscript file.

----------------------------------------------------------- The Time Traveler
I used to love her                                          a.k.a. Timur Tabi
But I had to kill her                            Internet: timur@seas.gwu.edu
I had to put her six feet under                  Bitnet:         HE891C@GWUVM
And I can still hear her complain  - Guns 'n Roses

alansari@copper.ucs.indiana.edu (Mohammad Al-Ansari) (04/23/91)

In article <1991Apr20.181504.699@midway.uchicago.edu> wer5@ellis.uchicago.edu (Will E. Rose) writes:
>Here's the story:
>
>First off, Windows puts a ^D at the start of a file, and Unix chokes on this,
>as well as any ^D in the file.  It must be deleted.  Also, the first line
>must be a %! all alone (Apple seems to prefer it that way).
>
>We have written a small program that will play this little game for you.
>It will run under Unix or DOS.
>
>Individuals may feel free to use this program.  _ANY_ organization or 
>institution must contact the authors first at wer5@midway.uchicago.edu.
>
>Questions/comments to me.
>

[program deleted]

This is strange! I have acquired W4W only about a week ago, and I have
been able to print to a file (in PostScript format), apload to a Unix
system (using kermit) and send files to an Apple Laserwriter II (among
others) without any problems!

I am not an expert on this but I just happen to know that this works
fine for me. Please email if you have any questions about configuration
or setup.


--
Mohammad Al-Ansari
Computer Science Department
Indiana University

sal@grip.cis.upenn.edu (Marcos Salganicoff) (04/23/91)

As a followup: It turns out the windows postscript driver sometimes
uses a lf character to seperate lines in the output file. When I used 
microemacs to delete the ^d at the beginning of the psfile and saved
the result the lfs were removed, ergo my keywords were smushed
together and the psfile was unparsable ==>
Don't use microemacs to diddle ps files from windows. Problem solved.
-Marcos

General Robotics and Active Sensory Perception Lab
The University of Pennsylvania
Philadelphia, PA (USA)

richardb@cognos.UUCP (Richard Brosseau) (04/23/91)

In article <1991Apr20.181504.699@midway.uchicago.edu> wer5@ellis.uchicago.edu (Will E. Rose) writes:
+Here's the story:
+
+First off, Windows puts a ^D at the start of a file, and Unix chokes on this,
+as well as any ^D in the file.  It must be deleted.  Also, the first line
+must be a %! all alone (Apple seems to prefer it that way).
+
+We have written a small program that will play this little game for you.
+It will run under Unix or DOS.
+

[program deleted]

A sed script works quite well also ....
-- 
Richard Brosseau       uunet!mitel!cunews!cognos!richardb

I think a burp died trying to get out of my mouth - Calvin