Using foo2zjs filter without CUPS (with FreeBSD's standard LPD instead)

Polytropon freebsd at
Wed Feb 2 20:35:40 UTC 2011

On Wed, 2 Feb 2011 22:24:42 +0330, Bahman Kahinpour <bahman.linux at> wrote:
> Hello,
> I have a HP LaserJet P1102 printer and I managed to get it working
> with CUPS and "foo2zjs" filter from I am interested
> in removing the CUPS and using the native LPD system of FreeBSD. But I
> have a question.
> What command should I specify as "if" Input Filter or "of" Output
> Filter in the /etc/printcap file for using it with LPD and foo2zjs
> filter?

Something like this (not tested) should work:

p1102:HP LaserJet P1102:sh:lp=/dev/ulpt0:sd=/var/spool/lpd/p1102:lf=/var/log/lpd:if=/opt/bin/filter-p1102

Then /opt/bin/filter-p1102 is where the printer filter resides.
In "my" nomenclature, /opt is for everything that is not managed
by the ports or by the system. Maybe you chose a better location,
e. g. /etc/filter-p1102 or /usr/local/filters/filter-p1102, just
as you like.

Also make sure the spool directory and the log file do exist.

The file filter-p1102 itself is just a shell script. It works as
a wrapper for your foo2<whatever> filter, foo2zjs in your case:

export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin
/usr/local/bin/foo2zjs-wrapper <your options>

It reads from stdin and outputs to stdout, and this mechanism
is embedded in lpd's processing chain, as far as I understood.

> The point is that I am sure it will work with foo2zjs and LPD as
> /dev/ulpt0 is recognized and works fine and I may simply use that as
> output port and there is nothing CUPS-dependent in foo2zjs.

True. Get rid of the CUPS monster and use the excellent system
tools to do this simple job.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list