Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!decwrl!adobe!delahunt From: delahunt@adobe.COM (Jim DeLaHunt) Newsgroups: comp.windows.ms Subject: Re: Printing WinWord remotely? /// Win3.0 Genoa VGA driver? Summary: %! is convention, ^D is protocol; neither is PostScript. Message-ID: <4142@adobe.UUCP> Date: 20 Jul 90 01:21:44 GMT References: <4995@milton.u.washington.edu> Reply-To: delahunt@adobe.com (Jim DeLaHunt) Organization: Adobe Systems Incorporated, Mountain View Lines: 79 This discussion on %! and control-D in PostScript(R) language files perpetuated some common misconceptions; I'd like to clear them up. I hope David Sampson will forgive me for picking on his message. In article dsampson@x102a.harris-atd.com (sampson david 58163) writes: >In article <4995@milton.u.washington.edu> >markad@blake.u.washington.edu (Mark Donnell) writes: > >>1) I am trying to print the output from WinWord on a remote NeXT >>printer. I print to a file.... >>I try printing it with 'lpr text.eps' - it spools, then dissapears.... > >Mark -- The next time you print to a file with the windows postscript >driver, take a look at the result. The first line in the file will >have something like this (without the quotes) "^D%! Adobe 2.0". >The problem is that ^D as the 1st character. This much is correct. > The Apple printers want >to see the %! as the 1st two characters in a postscript file... >The %! tells the printer "Postscript commin' at ya". The ^D in >front of that signal confuses the printer. It doesn't properly parse >the line. I believe that ^D is an attempt to force a top of page >(i.e. kicks out a sheet). This is a common misconception. In fact, the ^D byte ($04) is a protocol used by the serial and Centronics drivers in many PostScript printers, and it means "end of job". Other communications methods may have out-of-band ways of conveying the same information: e.g. AppleTalk has an out-of-band "end of job" signal and so does not intercept ^D bytes in the input stream. The "%!" is a convention which means "this is a PostScript language program", rather than text, or PCL, or whatever. It conforms nicely to the Un*x convention that the first two bytes of the file tell how to handle it -- remember "#!/bin/sh"? Since "%!" starts with "%", it is a PostScript comment, and the PostScript interpreter ignores it. (There are other conventions; ask Adobe Developer Support for the Document Structuring Conventions spec.) The standard Windows PostScript language driver, mixing protocol and page description, emits a page description with ^D bytes before and after it. If you send this stream to a printer via a serial or parallel port, the printer's RS232C or Centronics drivers interpret the initial ^D as the end of a (null) job and remove it from the input stream. The following bytes are the next job. The drivers interpret the final ^D byte as an end-of-job signal, remove it from the input stream, and pass the end-of-job signal to the interpreter. The interpreter reverts to its initial state and waits for the next job. If you intercept the Windows driver's stream into a file, and print it with the NeXT's 'lpr', it is sent to the Display PostScript interpreter via a NeXT-internal method, with an out-of-band protocol for end-of-job signals. (The same problem arises if your Un*x box sends the file to a printer via AppleTalk.) The ^D bytes have no special meaning, so they are passed to the interpreter. The interpreter treats the initial ^D byte as an undefined PostScript name, and flushes the job with an error. However, David came up with exactly the right workaround: >I wrote a simple program in C to filter the Control-D out of the file. >So my procedure for printing to a remote printer is as follows: > >1) Print to a file using the postscript driver from whatever windows >application you're in > >2) Exit windows and filter out that ^D > >3) Issue the lpr filename command command to the remote printer. I hope this explanation is helpful. >David Sampson Harris Corporation >dsampson@x102a.ess.harris.com Gov't Aerospace Systems Divison >uunet!x102a!dsampson Melbourne, Florida --Jim DeLaHunt delahunt@adobe.com (Internet) Technical Support ...!{sun,apple,decwrl}!adobe!delahunt (UUCP) Adobe Systems Inc. +1-415-962-3790 (Phone) +1-415-961-3769 (Fax)