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



At date and time Sun, 21 Jun 2015 09:18:39 -0700, jgw wrote:

  | 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.
  | 
  | 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.

That printing section in the FreeBSD Guide is very good! It gives a
great overview of the various parts and how they fit together. The
overview was what I was missing. Thanks for the reference. I'll
study the method below as well when I get back to that network
tomorrow.

  | 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!

-- 
Gerard Lally



Home | Main Index | Thread Index | Old Index