Printer hints for solaris

Brief intro for the uninitiated:

Solaris, and most appls that run under solaris, expect a postscript printer. If you dont have one, get one. If you cant afford one, install ghostscript, and read the ghostscript FAQ on setting up a printing filter.

That being said, now let's move on to the good stuff :-)

Solaris 11 printer syntax

Solaris 11 transitioned to using CUPS for its main print engine. The interfaces have changed significantly. There is a web interface, which is somewhat well documented. However, most people who come to my site, are probably more interested in the command line methods, which are poorly-documented in the Oracle docs.

Here is the cheat sheet that you probably care about:

# TO ADD A (generic HP style) NETWORK PRINTER to Solaris 11
lpadmin -p testprint -E -v socket://1.2.3.4 \
  -P /usr/share/ppd/SUNWhpijs/HP/hp-color_laserjet-ps.ppd.gz

# To view all defined printers
lpstat -v

# To view details on a named printer 'testprint'
lpstat -l -p testprint
Solaris 11 users should probably ignore the rest of this page.


Solaris 10 and older

The rest of the page is kept around for historical reasons.

The syntax that most people will care about:

What to do if you have a direct-attached(parallel port) printer

lpadmin -p lp -v /dev/lp[whatever] -T PS -I postscript

What to do if you have a networked HP printer

There are many pieces of advice, some of which include: BUT!

All of this seems now unneccessary, since HP net printers which emulate their own LPD have special names for internal filtering. Assuming your HP network printer has been added to the hosts table as "hplj", you could address it as

  1. lpadmin -p hp -s hplj
  2. lpadmin -p hp -s 'hplj!text'
  3. lpadmin -p hp -s 'hplj!raw'
  4. lpadmin -p hp -s 'hplj!auto'

#4 will automagically make everything work! It should accept postscript as postscript... but it will also take UNIX text, and add CR *iff* it is neccessary!

When I tried it on an HP 4050, anyways. Lemme know if it doesnt work on a relatively recent networked HP.


If you wanted to manually convert a text file to postscript, the mindless way, you can invoke the solaris PS filter by hand, with

/usr/lib/lp/postscript/postprint  file.txt >file.ps
Alternatively, on newer Solaris release, you can use the mp command:
mp  file.txt >file.ps

An obscure bit of info that I wanted to preserve on my own site:

If, as root, the command "lpfilter -f all -l" returns nothing, you should do the following:


# # Note that this is ksh syntax
# cd /etc/lp/fd
#   for file in * ; do
        sfile=${file%%.fd}
        lpfilter -f $sfile -F /etc/lp/fd/$file
        done

This will enable all the "filters" (like the "text to postscript" filter), that otherwise may not kick in.


Written by:Philip Brown
Back to Phil's Solaris pages