Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 3 May 2020 19:24:44 +0200
From:      Polytropon <>
To:        Victor Sudakov <>
Subject:   Re: Brother HL-L2340D printer and lpd?
Message-ID:  <>
In-Reply-To: <>
References:  <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Mon, 4 May 2020 00:12:59 +0700, Victor Sudakov wrote:
> Dear Colleagues,
> I'm trying to use a Brother HL-L2340D printer as a simple networked
> line printer with lpd. I've successfully used HP and Canon printers like
> that with a simple printcap like this:
> # by VAS
> lp|Brother HL-L2340D series:\
>         :sh:\
>         :rp=TEXT_P1:\
>         :rm=
> but the story with Brother HL-L2340D is different. When fed some input 
> with "lptest |lpr", it just spits out 3 empty pages. I've never seen
> anything like that before.

It's possible that your previous printers could understand
regular (unformatted) ASCII text, but the new one doesn't.

> I'm wondering if someone has this printer and made it work as a line
> printer.
>  From the specification at
> it should support LPD.

It's not a matter of supporting LPD - it's the question which
printer language the printer can process. The default output
format for programs is PS. According to the above specification,
the printer does not understand PS. However, it supports PCL,
and tools like gs (GhostScript) should be able to convert PS
to PCL. This is what you need to send to the printer.

I assume you're not using CUPS? In this case, a PPD file for
this printer would probably be the easiest thing, but you can
get around using CUPS of course.

Maybe this example can help:

First verify that the printer really understands PCL. You can
use nc (netcat) to send it some data directly. If it works,
instantiate a simple printer filter in /etc/printcap, for example:


Then rebuild printcap.db. Make sure the required directories
do exist. Here is the printer filter, /opt/libexec/

	/usr/bin/printf "\033&k2G" || exit 2
	/usr/local/bin/gs -q -dBATCH -dNOPAUSE -dPARANOIDSAFER -dSAFER \
		-sDEVICE=ljet4d -sPAPERSIZE=a4 -r600x600 \
		-dDuplex=true \
		-sOutputFile=- - && exit 0
	exit 2

I use that one with a HP Laserjet 4000 DN. There is also a
filter (and printer) for non-duplex, it's simply missing
the -dDuplex=true entry. ;-)

Adjust parameters you need, for example if you don't have
standard A4 paper or need a different resolution.

It might even be possible that you can use this example 1:1,
if the Brother HL-L2340D speaks PCL in a similar way to the
HP Laserjet 4000 DN - see the "ljet4d" device format, which
works both for a Laserjet 4 and a Laserjet 4000 (I have both).
Sidenote: That Laserjet printer can understand PS, PCL, and
ASCII text (including escape sequences for formatting etc.,
or real plain text without any preprocessing).

For more inspiration, check:

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

Want to link to this message? Use this URL: <>