Make your own free website on
Updated April 30 2003

Setting up Sun Solaris 2.6, 7, and 8 to print to Canon Networked Printers
using LPD

Solaris uses the lpsystem print subsystem.  There are two ways to print to a remote printer with lpsystem.

1.  Setting up the printer as a remote printer (must use this setup for EFI controllers)  This does not support filtering :-(  It sends the print job to the remote host and thinks the remote host will apply any needed filters.  Bummer.  You can print text and postscript but you get no funky extras.

2.  Setting up the printer as a local printer.  This works with the Canon print boards (example iR5000 GP200f)  This supports filtering and all kinds of great stuff.
When printing to the EFI controller with this setup, the banner page prints but not the document you send. That's real helpful!!
I reported this to EFI when the D1/E1 print board was first released and their response was "We don't support UNIX"  Where have I heard that before? ;-)

This information comes mostly from the Sun Solaris 2.6 and 7 System Administration Guide and the Man pages. 
This was tested with a SPARC5, Solaris 2.6, GP200f, e, and the iR400.
Also a SparcStation20 and Solaris 7 with the above models and the iR5000.

Note before starting:

There is a beta interface script for the lpsystem available on this site that gives full functionality for the EFI controller F1.  It should also work with the H1, K1, D1, and E1 although I have not tried them.

Executive Summary

1. Commands to make a remote printer accessible (use this one for EFI controllers)

    #lpadmin -p new_printer_name -s host_name!queue_name
    #lpadmin -p new_printer_name -T printer_type_list -I content_type_list

Example GP200e (with EFI controller)

    #lpadmin -p canon -s gp200e!print
    #lpadmin -p canon -T PS -I postscript,simple
(The host name gp200e needs to have an entry in /etc/hosts)

To test your new entry try:
    #lpstat -p canon

2. Commands to make a remote printer seem like a local printer( works with Canon controllers)

DON'T USE THIS ONE for EFI controllers!

    #lpadmin -p new_printer_name -v /dev/null
    #lpadmin -p new_printer_name -i /usr/lib/lp/model/netstandard
    #lpadmin -p new_printer_name -o dest=host_name:queue_name -o protocol=(bsd or tcp) -o timeout=n
    #lpadmin -p new_printer_name -T printer_type_list -I content_type_list
    #accept new_printer_name
    #enable new_printer_name

Protocol=bsd or tcp
bsd    LPR/LPD port 515
tcp     raw/streaming port 9100

The printer type (-T field) for a network printer can be unknown or PS

The content-type (-I field) can be the same type as the printer type (if the printer type is defined)
It can also be simple (meaning an ASCII file), which is the default content type for all printers.
It can also be any
In summary, here are some content-type (-I field) examples;
postscript    PostScript files do not require filtering.  
simple        ASCII files do not require filtering. 
any             No filtering required. If the printer cannot handle a file content type directly, the file will not be printed.

Some excellent documentation for this can be found using  Search for Planning Printers on Your Network (Overview)

Example GP200f

    #lpadmin -p canon -v /dev/null
    #lpadmin -p canon -i /usr/lib/lp/model/netstandard
    #lpadmin -p canon -o dest=gp200f:lp -o protocol=bsd -o timeout=5
    #lpadmin -p canon -T PS -I postscript
    #accept canon
    #enable canon
(The host name gp200f needs to have an enter in /etc/hosts)

To test your new entry try:
    #lpstat -p canon

  HEY Rick, we noticed you used "simple" as a content type on the remote setup but not on the local settup.  What gives?
A.  Well it is not the type of setup that determines the content type "simple" but how the printer board handles line feeds.  For more information read the filtering section at the bottom of this page.

Additional information: This doesn't include everything but lots of interesting stuff 
if you're into that sort of thing ;-)

Here is a quick reference chart

#lpstat -r See if the lpsched is running
lpsched is the printing daemon
#lpstat -p printer_name
Show basic status of  the printer printer_name

#lpstat -p printer_name -l Show detailed status of the printer printer_name
#lpadmin -x printer_name Delete the printer printer_name

#cancel -d printer-name job-id
Cancel a print job

#lpshut To turn off the scheduler

#lpsched To turn on the scheduler
#lpstat -d Show default printer

#lpstat -t Show detailed status of print services

Here's some details

The printing daemon is called lpsched
To see if it is running try:
    #lpstat -r
    #ps -e |grep lpsched

lpadmin : adding or changing a printer(s) options
lpadmin -p printer options
When adding a printer one of three options must be supplied : -v, -U, -s.
if -s is specified the following are invalid : -A, -e, -F, -h, -i, -l, -M, -m, -o, -U, -v, -W

Options we used:

-I content_type_list : allow printer to handle print requests with the content type listed in a content_type_list. If the printer type is specified by the -T option, then the printer type is also considered to be a valid content type.
-T printer_type_list : identify the printer as being of one or more printer types. Each printer type is used to extract data from the terminfo database; This information is used to initialize the printer before printing. Some filters may also use a printer type to convert content for the printer.

Network setup options we used

-s system_name!printer_name : make a remote printer accessible. System_name is the name of the remote system or host as specified in /etc/hosts, and the printer_name is the name of the queue on the remote system.  For your queue name try here.(see example in the executive summary)

Local setup options we used

-v device : the port the printer is connected to. For a network printer use /dev/null (the black hole)
-i interface : path to the interface program for the printer. For all network printers use /usr/lib/lp/model/netstandard
-o option : there are different options available for printing. We use dest which is destination, the host name; protocol which is the method to use to communicate to the printer. we use bsd; timeout the number of seconds to wait between attempting connections to the printer.

Banner Page

Remote setup.
to disable banner page on the remote setup the user has to add -o nobanner when printing
    #lp -d canon -o nobanner
or if you don't want to /can't add -o nobanner check our banner page.

Local setup.
If you edit the file /etc/lp/interfaces/printer_name and change the entry
nobanner=no to nobanner=yes
it will stop the local UNIX banner page but not the EFI banner page.
To stop the EFI banner page check out  The Banner page.

Deleting the Printer

Remote printer
    #lpadmin -x printer_name
to verify
    #lpstat -p printer_name -l

locally installed remote printer
    #reject printer_name
    #disable printer_name
    #lpadmin -x printer_name
to verify
    #lpstat -p printer_name -l

Cancelling a print job

#cancel -d printer-name job-id

Checking the printer status

Show default printer
    #lpstat -d

Show description of printer
    #lpstat -p printer_name -D

Basic status of printer
    #lpstat -p printer_name

Detailed status of printer
    #lpstat -p printer_name -l

Status of print services
    #lpstat -t

Restarting the Print Scheduler

Check to see if scheduler is running
    #lpstat -r

Turn off scheduler

Turn on scheduler


I have received some great help from Jason Banham, Kernel & Network Services, Sun Microsystems Ltd UK regarding filtering.  Thank you very much Jayce.

This OS does support filtering for local printer setups but not for remote setups.
The easiest way I can think to explain this is to show you an example.  Since it only works on local setups I'll do the GP200f controller.

Using the executive summary from above but using the GP200f we get:

    #lpadmin -p canon -v /dev/null
    #lpadmin -p canon -i /usr/lib/lp/model/netstandard
    #lpadmin -p canon -o dest=GP200f:lp -o protocol=bsd -o timeout=5
    #lpadmin -p canon -T PS -I postscript
    #accept canon
    #enable canon

The problem here is that this will convert everything to postscript before printing.  If we want to print ASCII as ASCII and not as postscript we need to add the content type "simple"
     #lpadmin -p canon -I postscript,simple   (don't do this, only to help with example)

When using the content type "simple" the GP200f prints text with the staircase effect.
If you have another model that is giving you the staircase effect, check here for help
We need to filter the print data and have every lf (line feed) converted to lfcr (line feed carriage return).  This will fix the staircase effect.  There are many types of filters you can use here.  The following filters are just two of the many.  If you have one, send it in  and we'll start a collection just for fun. 

Updated Dec 12 2002
 Third script.
Hugh Sasse <hgs AT dmu DOT ac DOT uk>  sent us this awk script and some notes.

[awk is] lighter weight than Perl, no compiling (and no compiler with
default Solaris anyway - ouch!). 
[Also,] I think in Ruby ( it would be

#!/bin/env ruby -p

which seems to work.  -p does pretty much what perl's does, sub!
changes the reciever ($_ in this case).

Before you ask, I'm not fluent in lua, but it would probably be faster!
There are caveats with the awk script:
    1 I used Sun's awk, which I think is really nawk, and so the \r
    stuff may not be supported on all awks.  I've not tried others
    such as gawk, mawk, ...
    2 I assumed pretty much that if there's a \r then there is always a
    \n after it --- i.e. there is never a /\r[^\n]/ regexp in the file.
    [Certain word processors on DOS and CP/M used to use \r as a hard
    return and \n as a soft return.  These files could be interesting
    to print.  (But then, they often set high bits on chars to do
    things like underlining!)]  This is a different assumption from the
    above Ruby script.

Back to your regularly scheduled document.

1. a perl script.  (right click and save link as...)  You must have Perl installed for this to work.  This is from Grant Taylor of Linux Printing HOWTOfame.  Thanks Grant.
2. a C program source code.  (right click and save link as...)  You must have a C compiler installed to use this one.  This is from Rocco Lapadula.  Thanks Rocco.

Pick the filter you want to use and configure it for your enviroment.  For the perl script check your paths and the C source needs to be compiled.
When your filter is ready, rename it 'stairfix' (you can name it what you want but for our example we use stairfix).
Move it to the /usr/bin directory and make sure it is executable.
    #chmod 755 /usr/bin/stairfix

Cool, now that we have our filter, we need to define it.
Change to the /etc/lp/fd directory and open your favorite text editor (use vi, no really, come on, it's way better) and input

    Input types: simple
    Output types: stairfix
    Printer types: any
    Printers: any
    Filter type: slow
    Command: /usr/bin/stairfix

Now save as /etc/lp/fd/stairfix.fd

Now that we have our filter and filter definition file we can register the filter:
    Syntax     lpfilter -f <filter_name> -F <filter_definition_file>

    # lpfilter -f stairfix -F stairfix.fd

Finally we can add the content type stairfix.  This will take any input that is 'simple' text and run it through our filter.
    #lpadmin -p canon -I postscript,stairfix

We should be done.  Test out your new setup.
To print ASCII:
    #lp file.txt

To print postscript:
    #lp -T postscript

Good luck and have fun. Unix Rocks
All your UNIX are belong to us.

Some handy looking URLs
Basic Principles of Printing in Solaris[tm] 2.6 and above.  []
Printing and Plotting  []
Writing a LP Interface Script []
Printing in the Solaris[tm] Environment: Using the LP Subsystem  []

Solaris Print Manager (GUI)
#/usr/sadm/admin/bin/printmgr &

Back to UNIX&n