Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Jul 2014 01:51:49 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Beeblebrox <zaphod@berentweb.com>
Cc:        freebsd-questions@freebsd.org
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> <alpine.BSF.2.11.1407180554080.77290@wonkity.com> <1405689027711-5929805.post@n5.nabble.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <px - page.pwidth, py -
> 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, ...



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