From owner-freebsd-questions Tue Oct 7 03:00:46 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id DAA13944 for questions-outgoing; Tue, 7 Oct 1997 03:00:46 -0700 (PDT) (envelope-from owner-freebsd-questions) Received: from freebie.lemis.com (gregl1.lnk.telstra.net [139.130.136.133]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id DAA13932 for ; Tue, 7 Oct 1997 03:00:39 -0700 (PDT) (envelope-from grog@freebie.lemis.com) Received: (from grog@localhost) by freebie.lemis.com (8.8.7/8.8.5) id TAA03025; Tue, 7 Oct 1997 19:29:18 +0930 (CST) Message-ID: <19971007192918.48284@lemis.com> Date: Tue, 7 Oct 1997 19:29:18 +0930 From: Greg Lehey To: Jacques Hugo Cc: FreeBSD Questions Subject: Re: HP Laser 5 References: <3439F22D.2781E494@wired.ctech.ac.za> <19971007185701.08046@lemis.com> <343A0255.446B9B3D@wired.ctech.ac.za> <19971007191619.55515@lemis.com> <343A06D1.794BDF32@wired.ctech.ac.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.84e In-Reply-To: <343A06D1.794BDF32@wired.ctech.ac.za>; from Jacques Hugo on Tue, Oct 07, 1997 at 11:54:25AM +0200 Organisation: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8250 Fax: +61-8-8388-8250 Mobile: +61-41-739-7062 WWW-Home-Page: http://www.lemis.com/~grog Fight-Spam-Now: http://www.cauce.org Sender: owner-freebsd-questions@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk On Tue, Oct 07, 1997 at 11:54:25AM +0200, Jacques Hugo wrote: > Greg Lehey wrote: > >> Does >> it >> maybe >> have >> a >> staircase >> effect? > > Yip! That's it. Aaaaah. That took a lot of extraction. > And if I pipe a txt file through it, > you get the staircase effect plus say if I cat the > /etc/passwd file to lpr I get > > root:*:0:0:Charlie &:/root:/bin/csh > toor:*:0:0:Bourne-again Superuser:/root: > > the staircase effect and printed output isn't complete. Sure, it's all overhanging the right margin. This is described in the handbook section on printing. Basically, you need a filter which sets the control characters correctly. Here's the example from the handbook: Installing the Text Filter We are now ready to tell LPD what text filter to use to send jobs to the printer. A text filter, also known as an input filter, is a program that LPD runs when it has a job to print. When LPD runs the text filter for a printer, it sets the filter's standard input to the job to print, and its standard output to the printer device specified with the lp capability. The filter is expected to read the job from standard input, perform any necessary translation for the printer, and write the results to standard output, which will get printed. For more information on the text filter, see section Filters. For our simple printer setup, the text filter can be a small shell script that just executes /bin/cat to send the job to the printer. FreeBSD comes with another filter called lpf that handles backspacing and underlining for printers that might not deal with such character streams well. And, of course, you can use any other filter program you want. The filter lpf is described in detail in section lpf: a Text Filter. First, let uss make the shell script /usr/local/libexec/if-simple be a simple text filter. Put the following text into that file with your favorite text editor:
#!/bin/sh # # if-simple - Simple text input filter for lpd # Installed in /usr/local/libexec/if-simple # # Simply copies stdin to stdout. Ignores all filter arguments. /bin/cat && exit 0 exit 2
Make the file executable: chmod 555 /usr/local/libexec/if-simple And then tell LPD to use it by specifying it with the if capability in /etc/printcap. We will add it to the two printers we have so far in the example /etc/printcap:
# # /etc/printcap for host rose - added text filter # rattan|line|diablo|lp|Diablo 630 Line Printer:\ :sh:sd=/var/spool/lpd/rattan:\ :lp=/dev/lpt0:\ :if=/usr/local/libexec/if-simple: bamboo|ps|PS|S|panasonic|Panasonic KX-P4455 PostScript v51.4:\ :sh:sd=/var/spool/lpd/bamboo:\ :lp=/dev/ttyd5:fs#0x82000e1:xs#0x820:\ :if=/usr/local/libexec/if-simple:
BTW, I would very much doubt that this problem doesn't exist under Linux. The reasons are the same. Greg