From owner-freebsd-questions@FreeBSD.ORG Fri Jul 18 23:51: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 6556E32A for ; Fri, 18 Jul 2014 23:51:52 +0000 (UTC) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 010DF2D9A for ; Fri, 18 Jul 2014 23:51:51 +0000 (UTC) Received: from r56.edvax.de (port-92-195-69-249.dynamic.qsc.de [92.195.69.249]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id 213973CC8B; Sat, 19 Jul 2014 01:51:50 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id s6INpnZE002613; Sat, 19 Jul 2014 01:51:49 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Sat, 19 Jul 2014 01:51:49 +0200 From: Polytropon To: Beeblebrox Subject: Re: printcap configuration problem Message-Id: <20140719015149.1cb323c2.freebsd@edvax.de> In-Reply-To: <1405689027711-5929805.post@n5.nabble.com> References: <1405676044178-5929730.post@n5.nabble.com> <1405689027711-5929805.post@n5.nabble.com> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: Fri, 18 Jul 2014 23:51:52 -0000 On Fri, 18 Jul 2014 06:10:27 -0700 (PDT), Beeblebrox wrote: > > You can also define $PRINTER (for example in /etc/csh.cshrc globally) with > > the name of the printer. > I had never read about this and it never ocurred to me before - thanks. > As you guessed, I was not using "lpr -P hp2100" Just set $PRINTER and never worry again. :-) > > These are CUPS options. Standard lpd does not understand them. > Well a day's work wasted there... No, you have learned something, so it has not been wasted. > > Or apsfilter options. > Hence the idea of modifying my existing /usr/local/libexec/lf2crlf to define > the desired printer settings, since appsfilter is a collection of filter > files, AFAIK? Yes. I've been using apsfilter in the past, but it seems that it doesn't receive much more development work. On the other hand, CUPS has become _the_ standard for printing, sometimes even required as a dependency even when it's not needed at all. Programs rely on its presence much more than on the system's provided spooling and filtering interfaces, so using it often is the only chance to get "mainstream software" working, whereas other, "un-normal" software keeps working with whatever is there. > I had already read in man printcap that one must use page.plength> (in pixels) as page size. However considering that I have > print/papersize-default-a4 installeed, there should be a simpler way to > define it as default rather than px/py in printcap? Those settings should be better put into the printer filter or its configuration. This is what CUPS manages independently. But you can also do this with your own filter if it doesn't have much to do. This is an example of how I have been working (outside of CUPS), the /opt/libexec/ps2pcl-dup.sh filter: #!/bin/sh /usr/bin/printf "\033&k2G" || exit 2 /usr/local/bin/gs -q -dBATCH -dNOPAUSE -dPARANOIDSAFER \ -dSAFER -sPAPERSIZE=a4 -r600x600 \ -sDEVICE=ljet4d -dDuplex=true \ -sOutputFile=- - && exit 0 exit 2 You can see that I've been using gs (ghostscript) with the options defining the required paper size (ISO A4) and resolution (600 dpi). The printer driver used by gs is "ljet4d" which works with the HP LaserJet 4000 DN I'm still using. In most cases, it doesn't even matter which printer driver you specify as long as it's "halfway compatible" (here: works for many PCL-based printers). The printer filter (script) doesn't do much more than process the input from the application which is printing, usually PS, obtained via standard input, to become the output desired, sent to standard output. The mechanism of /etc/printcap makes sure the data arrives at the correct point (network IP or name, maybe with a specified port number, or a parallel or USB connector). Having those means separated makes troubleshooting and testing quite easy. You can use netcat (nc) to feed output directly to the printer, or > it into the /dev/whatever directly. You can examine the (intermediate) printer data or temporarily change the destination. > Also, I do not find any way of defining resolution (r=), quality (q=) and > orieantation (m=) in printcap, and the job ends up using the default printer > settings (excluding the a4 parameter which is sent from host) - so I > logically come back to the filter file... Those are usually defined _in_ or _for_ the printer filter. CUPS manages those sufficiently well. The web interface is slow to use, but if you can get used to it, changing parameters is easy. There are also configuration files located in /usr/local/etc/cups, and finally there's lpadmin. -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...