From owner-freebsd-questions Sun Oct 8 5:39:42 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mta06-svc.ntlworld.com (mta06-svc.ntlworld.com [62.253.162.46]) by hub.freebsd.org (Postfix) with ESMTP id 6070937B503 for ; Sun, 8 Oct 2000 05:39:37 -0700 (PDT) Received: from parish ([62.255.96.69]) by mta06-svc.ntlworld.com (InterMail vM.4.01.02.27 201-229-119-110) with ESMTP id <20001008123934.MYIK19246.mta06-svc.ntlworld.com@parish>; Sun, 8 Oct 2000 13:39:34 +0100 Received: (from mark@localhost) by parish (8.11.0/8.11.0) id e98CcsN01380; Sun, 8 Oct 2000 13:38:54 +0100 (BST) (envelope-from mark) Date: Sun, 8 Oct 2000 13:38:54 +0100 From: Mark Ovens To: Chris Hill Cc: Matthew Rochlin , FreeBSD Questions List Subject: Re: HP Laserjet with JetDirect Network card -- how-to Message-ID: <20001008133854.C253@parish> References: <4.3.2.7.2.20001007140207.0189db68@pop3.norton.antivirus> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5i In-Reply-To: ; from chris@monochrome.org on Sun, Oct 08, 2000 at 01:24:29AM -0400 Organization: Total lack of Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, Oct 08, 2000 at 01:24:29AM -0400, Chris Hill wrote: > On Sat, 7 Oct 2000, Matthew Rochlin wrote: > > > Thanks for your suggestion... > > > > It works (mostly), but only on postscript files. (I don't have ghostscript > > or any other postscript generating tool on my BSD machine at the moment, > > If you have a Postscript printer, you don't need ghostscript, except > maybe for viewing PS on-screen. gs allows a non-PS printer to print PS > files. PS printers used to be very expensive due to Adobe's high > licensing fees. > > > lpr test.prn > > > > Printed out the document (your email, actually) fine. But if I try to > > print plain text, I get just the first line, somewhat garbled at the end > > (the next two lines print out shifted to the far right and the rest of the > > document doesn't print at all). > > The infamous stairstep effect! This happens because a unix newline is a > single LF character, where the printer is probably expecting a CR and an > LF like what DOS produces. I'll bet if you try to print a plain text > file with one word per line, > it > will > look > like > this. > > Having said that, I don't remember how to fix it but if you search the > archives under "staircase" or "stairstep" you should turn up something. > It was a simple fix, I just don't recall what it was. > Not sure if this will work with a PS HP printer but since they also support PCL it should do. Add :if=/usr/local/libexec/hpif: to the /etc/printcap entry and put this in /usr/local/libexec/hpif: # # Read first two characters of the file # read first_line first_two_chars=`expr "$first_line" : '\(..\)'` if [ "$first_two_chars" = "%!" ]; then # # It is PostScript; use Ghostscript to scan-convert and print it. # # Note that PostScript files are actually interpreted programs, # and those programs are allowed to write to stdout, which will # mess up the printed output. So, we redirect stdout to stderr # and then make descriptor 3 go to stdout, and have Ghostscript # write its output there. Exercise for the clever reader: # capture the stderr output from Ghostscript and mail it back to # the user originating the print job. # exec 3>&1 1>&2 /usr/local/bin/gs -dSAFER -sPAPERSIZE=a4 -dNOPAUSE -q \ -sDEVICE=cdj550 -sOutputFile=/dev/fd/3 - && exit 0 else # # Plain text or HP/PCL, so just print it directly; print a form # at the end to eject the last page. # printf "\033&k2G" && echo $first_line && cat && \ printf "\033&l0H" && exit 0 fi ESC&k2G is the PCL escape sequence to make the printer to interpret LF as CR/LF and ESC&l0H resets it. Since this is a PS printer you will need to change the line starting ``/usr/local/bin/gs'' to something like: echo $first_line && cat && exit 0 > > Is there maybe something I need to do to distinguish plain text from > > postscript? > > Not on my printer; it seems to recognize the Postscript header and deal > with it automagically. PS or plain text, I just do a 'lpr filename' and > it works. > > > Thanks! > > (PS -- I also had to enable the printer spool daemon in > > /etc/rc.conf ... lpd_enable="YES" ... per the Almost Complete > > FreeBSD. Not enabled by default on my system. Maybe an installation > > option I missed?) > > Woops, I forgot about that - sorry! It's been a while. I think the > reason it's not on by default is that a) most things aren't in FreeBSD > and b) lots of systems, e.g. servers, don't have or need a printer. > > PS - you should copy replies to the list (which I have done here). Most > of these folks know a lot more than I do. > > -- > Chris Hill chris@monochrome.org > [1] Bus error netscape > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- 4.4 - The number of the Beastie ________________________________________________________________ 51.44°N FreeBSD - The Power To Serve http://www.freebsd.org 2.057°W My Webpage http://ukug.uk.freebsd.org/~mark mailto:marko@freebsd.org http://www.radan.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message