Skip site navigation (1)Skip section navigation (2)
Date:               Tue, 5 Mar 1996 09:20:46 +600 CDT
From:      "Larry Dolinar" <LARRYD@bldg1.croute.com>
To:        questions@freebsd.org
Subject:         Re: Printing
Message-ID:  <494B8A65C27@bldg1.croute.com>

next in thread | raw e-mail | index | archive | help
I guess that was the original post; nothing was said about the contents of 
/etc/printcap.

These comments go with the following caveats:

    - I did mine on a DeskJet 540; only playing with text output right
      now.

    - Mine worked on the first try, but that's because I played with the 
      awk script on a text file to verify the output was what I wanted.
    
Here's something I posted 17 Jan; based on the problem described, it 
should fix the problem.  Look carefully at the part that describes the 
input filter (some of 2 and all of 3) and ignore the stuff you already 
know.

That said, here goes...

--------------------------------------------------------------------------

1.  Make sure irq 7 isn't used by anything else, or use lptcontrol to set
    the mode to polled.  Without reconfig'ng the kernel, polled is much 
    preferrable.

2.  Create a simple /etc/printcap as follows; mine's for an HP 540 
    inkjet (parenthetical comments for reference ONLY):

#
lp|HP Deskjet 540:\
    :lp=/dev/lpt0:\                         (output device)
    :sd=/var/spool/lpd:\                    (spool directory)
    :lf=/var/log/lpd-errs:\                 (log file)
    :if=/usr/local/libexec/if_dj_540:\      (input filter, see comments)
    :tr=\f:\                                (trailing string,    "   )
    :sh:\                                   (suppress banner)
    :mx#0:                                  (unlimited job size)

The input filter (if) could be anywhere; this one just adds CR to the
normal LF sequence of unix: without it, most printers will just
stair-step the output, and page printers (lasers/inkjets) will truncate
the line.

The trailer (tr) is used when the queue empties.  I found that the form 
feed (\f) was basically required for the HP to print properly.

3.  Make an input filter similar to the following:

# if_dj540      simple parlor trick to add CR to LF for printer
#
awk '{printf "%s\r\n", $0}' -

For those of you that don't see quite what this does: every line of 
standard input is printed with CRLF attached.  There are certainly more 
elegant ways of doing it, but this one avoids the approach of 
reprogramming the printer to append CR to LF, then having to undo it at 
the end of every job (unless you dedicate your printer to FreeBSD  8)  ).

4.  Just    lpr <file_of_choice> and you should be there...

--------------------------------------------------------------------------

Another comment on 3: because printf() is used instead of print(), you 
get full control over what you add to the line ($0).

cheers,
larry


|  On Mon, 4 Mar 1996, Michael J Vukovich wrote:
|  
|  > 
|  > 
|  > We have been trying to set up a HP Laserjet
|  > 4M Plus to print under FreeBSD. To this point
|  > we have not been able to stop the staircase
|  > effect from happening every time we print. We
|  > down-loaded the handbook and followed the 
|  > instructions under the printing section and have
|  > gotten nowhere. The input filter does not appear
|  > to work (we used the exapmle filter included in
|  > the handbook and many modifications), and we have
|  > tried setting CRMOD and several other fixes in the
|  > printcap file as well. Any suggestions that we might
|  > try? 
|  
|  How odd, that the input filter would not work.  Have you doublechecked it 
|  against the LaserJet manual and made sure that is the proper command 
|  code?  I have a DeskJet 500C that exibits the same behavior, but the 
|  sample worked fine.
|  
|  You may try installing one of the filters that are available, such as 
|  apsfilter and ... oh, there is another one that does more than apsfilter, 
|  but i can't remember the name.  I have apsfilter and no staircase shows.
|  
|  > Our only other recourse we be to get Linux or
|  > Solaris, since none of us have the time to waste
|  > writing our own code to get around this problem.
|  
|  That would not be good.
|  



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