Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Jan 2001 16:33:58 GMT
From:      def1@iname.com
To:        freebsd-questions@freebsd.org
Subject:   lpt0 / lp driver
Message-ID:  <200101051633.QAA16180@groggy.anc.acsalaska.net>

next in thread | raw e-mail | index | archive | help
for more than a few years i have had the same problem on
many printers on many machines bar none.  the problem is
that the first file of a print job gets an extra blank
line at the top of the page, decreasing the number of
lines on the first page of a set of print jobs by one.

ie - if i say:

$ cat file1 | lpf > lpt0 && cat file2 | lpf > lpt0

then only file1 will be prefixed with a blank line on it's
first page, file2 will print as expected.  this is the filter
i use ... [please ditto any responses off list, thanks ...]

#!/bin/sh
#
# lpf -- LP Filter.
# prints PS (%!) * DOS (CRLF) * UNIX (LF) files.
# printer should be set to DOS mode -> EOL=CR/LF.
# 'read' destroys any ASCII 0 characters in 1st line.
# 'echo' destroys leading whitespace space in 1st line.

# PRN='-sDEVICE=okiibm  -r240x144'  # EPSON FX-100
# PRN='-sDEVICE=djet500 -r300'      # HP DJ500
# PRN='-sDEVICE=cdj850  -r300'      # HP DJ850
  PRN='-sDEVICE=ljet2p  -r333'      # OKIDATA OL600e

read -r line1 # snag 1st line into filter, don't treat \'s specially.
if   echo "$line1" | grep -q '^%!'; then gs -q $PRN -sOutputFile=- -                     && exit 0
elif echo "$line1" | grep -q  '^M$'; then echo "$line1";  cat               && echo -n  && exit 0
else                                     echo "$line1^M"; cat | sed s/$/^M/ && echo -n  && exit 0
fi
exit 2


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




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