Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 08 Apr 2000 05:21:06 -0400
From:      Zdenek Radouch <zdenek@mediaone.net>
To:        freebsd-hackers@freebsd.org
Subject:   postscript printer handshake problem
Message-ID:  <200004080821.EAA11709@chmls06.mediaone.net>

next in thread | raw e-mail | index | archive | help

Problem:
I don't know how to configure the spooler to properly handshake
with a postscript printer (via standard parallel port).

Background:
I am trying to improve printer connectivity in my wife's graphic design
office.  The basic idea I had was to take the direct-attached postscript
printers that currently have direct connections to a Mac or PC, and
hang them off one of the freebsd machines I have, thus effectively
converting the printers to network printers.  I did that, and very quickly
found out that it does not quite work.

Details and my theory:
It is not exactly clear to me what's happening since the behavior is complex
and the errors are not simply obvious.  Additionally, the Windows and Mac
postscript drivers seems to have their own issues.

some of the problems I see are:
[Note that most of the files do get printed OK]

1) some files leave the printer in a busy state (this does not
    happen with a short postscript test code.
    This suggests missing Ctrl-D handshake from the spooler.
2) appending Ctrl-D to the files that leave the printer busy
    causes an extra page to be ejected/printed.
    Can't explain this.
3) Some jobs result in a extra page printed with the text "%%EOF"
    on it.  I can't understand how the interpreter can let this
    (DCS comment) through.
4) Some jobs do not get interpreted - the printer spews the postscript
    source code - very annoying since a 20MB postscript source for
    a two-page ad with graphics can make the printer waste an
    entire box of paper.  This may be related to 3) above - the printer
    clearly has a mode to pass ASCII through and print it without any
     interpretation - the question is how does this happen to a proper
     postscript source file.

It looks like there are at least two problems:

1) the freebsd spooler does not handshake properly with the printer
  I have been quite ignorant of the lpr subsystem, so I have
no idea how it is supposed to work, but based on my understanding
of postscript (feel free to correct me), I'd expect the following:
The spooler should examine the first couple bytes of the job file and look
for the DSC pattern (%!) and use that to decide whether or not the printer
is a postscript printer.  For a non postscript printer it can simply dump
the job file in the printer.  When talking to a postscript printer (really a
postscript interpreter), the spooler has to send Ctrl-D to indicate the end
of the job - the interpreter uses that to reset its current environment upon
completion of the current job, then sends Ctrl-D back to the spooler to
indicate that the next job can be started.  Without the Ctrl-D the printer
will assume that more pages are coming and either time out,
or possibly fail the subsequent postscript processing because code
from the previous job may still sit on the interpreters stack.

2) The windows driver clearly violates the DSC by inserting Ctrl-D at
    the end of the postscript file (But given the other problems I can
    see why they'd do that).


I'd really appreciate if someone who is familiar with the bsd spooler could
comment on this.  I am interested in how the spooler code currently works
when it comes to handshaking with postscript printers.

Of course, any other pointers are welcome; if this is known not to work,
let me know, too.

(BTW, the machine with the spooler runs freebsd 3.4 and the printer
sits on /dev/lpt0.  Also, the Mac and Windows boxes can print without
any problems when they are attached directly and  using their native
spoolers.)


Please respond to me directly at zdenek@mediaone.net, 
I don't read this mailing list.  Thanks.

-Zdenek




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200004080821.EAA11709>