NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Printing to a network printer by IP address



Gerard Lally <lists+netbsd.current.users%netmail.ie@localhost> wrote:

> (NetBSD 7 amd64)
>
> Is is possible to print to an ethernet-connected printer with just the
> standard NetBSD print commands, without going through CUPS? The printer
> is connected directly to the network switch and has a fixed IP address
> on the LAN; there is no print server. It is a business-class Ricoh
> Aficio MP C2800 Postscript and PCL printer.
>
> I have a hard time getting a conceptual overview of printing in BSD and
> Linux to be honest; it seems to be a bit of a minefield with postscript,
> CUPS, filters, ghostscript, foomatic, drivers, spooling, line printing
> and so on.
>
> At the moment I would like to print a copy of some of the text
> configuration files in /etc but it would be useful eventually to be
> able to print documents formatted with graphics as well.
>
> -- 
> Gerard Lally

As others mentioned, you can just setup BSD lpd.  You will likely need to
create a filter for it as well as a spool file.  And probably install
ghostscript.  I believe the FreeBSD Guide has some info on it.  I've been
using it for years with an HPLJ and it works fine for occasional print
jobs.  If you want my notes let me know off-list.

A few years ago I came across an alternate technique using just netcat/ncat
which is actually very fast if you can avoid dealing with postscript; my
notes are below:

 --
  Printing w/o lpd(8) to a Network Printer:

  Using ncat(1) and an appropriate print filter you can print directly to
  a network printer that understands "raw" input.

  For example, the HPLJ-2100 is a PCL-only printer (doesn't understand
  Postscript) and listens on port 9100.  The following makes use of the
  current lpd(8) print filter to process plain text, Postscript and PCL
  files:

  % cat cat_sitter.ps | /usr/local/lib/if\-hplj_2100 | ncat 192.168.1.12 9100

  The filter uses gs(1) (Ghostscript), something like so:

  % gs -q -dSAFER -sDEVICE=lj5gray -sOutputFile=- -

  This requires a lot of CPU cycles and produces rather large PCL outputs.
  It's better to produce PCL source files directly if possible:

  ex)
  # create a PCL file created two ways:
  % groff -ms -Tlj4 my_file.ms > cat_sitter.pcl
  % groff -ms my_file.ms | gs -sDEVICE=lj4 -sOutputFile=cat_sitter.PCL -

  # compare the files
  %  ls -sh1 my_file.{pcl,PCL}
  1.2M my_file.PCL
  3.8K my_file.pcl  => over 300x difference!

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

 This email has a PGP signature attached; verify
 using PGP public key at http://jgw.sdf.org/pgp/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJUx97aAAoJELZg2zktVKWMNZUP/ispNTlNSjx0QoKChol0sZSF
55ZvdtINHvA5DL0M78kXVkFqzWDdnAjE857iK8fXbj5Az6tx05DY+iovf6qUyLKF
X/5Jm82B8xAlSu8AlM37su8TzAgh51rw0UPJ1qhfaiamjognk6Yc0fFCnsWlaElp
1toKk++UghXfcWkY4hs3t6S//Nzf1WTg3mwKHVfmMJy2I2doXjI1Ok2ogB11gQX9
7HqJVpHcRzdel3iAUgmzruexQzBXpuBdylAjLfGiF7bVgP3bK4teck/D46BP09qJ
XBPKgNwbHtCRqArfRjMb92EhzgZjUftadJwDmPFlE7N1nn2tBP2pmwb8lhq18CsS
2uyflSrVMwFuRYYCXcfPTYl+mUTg0kA9MAp/gNVOAc+9B7TfjWN1HkCBnOuBFtI2
7nH7xJ3eEeOaoTRZPXo0WSWcAtWDXXbdZXW8cgVUIxggQLVA22CTKMRUTGfeJwcS
KAbzyZu/z2/V04Ygnu2hzgAGulw4qvv0cREiOVHVdpgaq8hEH2/U/yKqaXTf5NCp
P+9NKQDGgnt2cWNibUAzF563uvnOL3OnnjeT6/PLsfzJkpOFPi/H/UHc8a6Hjc8F
l2S9u+5Lu4DFfXjewTRT8NLmeal3kppHBwHIeGVavWlmLET0bvSj486qimXVv2SN
fwEG5kbnu8pX89ZowR8U
=KFMw
-----END PGP SIGNATURE-----


Home | Main Index | Thread Index | Old Index