From owner-freebsd-questions@FreeBSD.ORG Sat Aug 2 16:34:52 2014 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8E1F720F for ; Sat, 2 Aug 2014 16:34:52 +0000 (UTC) Received: from wonkity.com (wonkity.com [67.158.26.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "wonkity.com", Issuer "wonkity.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3BD412203 for ; Sat, 2 Aug 2014 16:34:52 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.9/8.14.9) with ESMTP id s72GYh0p006194 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 2 Aug 2014 10:34:43 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.9/8.14.9/Submit) with ESMTP id s72GYhdZ006189; Sat, 2 Aug 2014 10:34:43 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Sat, 2 Aug 2014 10:34:43 -0600 (MDT) From: Warren Block To: Beeblebrox Subject: Re: printcap configuration problem In-Reply-To: <1406986762673-5934162.post@n5.nabble.com> Message-ID: References: <1405676044178-5929730.post@n5.nabble.com> <53C919E0.6070008@bananmonarki.se> <20140718183958.1864052a@rsbsd.rsb> <20140727221419.35efb9b0@morena.maps.net> <1406966714419-5934110.post@n5.nabble.com> <1406986762673-5934162.post@n5.nabble.com> User-Agent: Alpine 2.11 (BSF 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (wonkity.com [127.0.0.1]); Sat, 02 Aug 2014 10:34:44 -0600 (MDT) Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Aug 2014 16:34:52 -0000 On Sat, 2 Aug 2014, Beeblebrox wrote: > @Warren: > Below is what I have in printcap and the filter file. psif is straight out > of the Handbook page. When printing an existing ps file with "$ /usr/bin/lpr > -Php2100", the resulting hardcopy has 3-4 lines truncated from the top - I > can't figure it out. Sorry, I don't understand the question. > Secondly, I don't see the point of piping an already ps-formated file > through ghostscript, unless it's to adjust print resolution. Is gs smart > enough to recognize a ps file and simply (and quickly) modify the ink amount > or must it do a complete re-process of the page? Ghostscript is not involved here. The first two characters of the incoming file are read. If they are %!, it is assumed to be a PostScript file and sent straight through. Otherwise, it is assumed to be a plain text file, and formatted into a PostScript file with print/enscript-[letter|a4]. Both cases are for use with a printer that understands PostScript natively. A plain LaserJet 2100 does not, although there was a 2100m that did, and a PS SIMM could be added to the other models. > hp2100:lp:rm=192.168.1.9:rp=raw:\ > :if=/usr/local/libexec/filters/psif:\ > :lf=/var/log/lpd-errs:af=/var/spool/lpd/acct:\ > :sd=/var/spool/lpd/hp2100:\ > :mx=0:sh: > > # psif: Print PostScript or plain text on a PostScript printer > IFS="" read -r first_line > first_two_chars=`expr "$first_line" : '\(..\)'` > > case "$first_two_chars" in > %!) > # %! : PostScript job, print it. > echo "$first_line" && cat && exit 0 > exit 2 > ;; > *) > # otherwise, format with enscript > ( echo "$first_line"; cat ) | /usr/local/bin/enscript -o - && exit 0 > exit 2 > ;; > esac