previous up slap
SmartLabel printing for UNIX

SmartLabel Printing via the Print-Spooler


Doing it Properly

Rather than keep it to themselves, many people will want to deploy their Smart Label Printer as a shared resource, via their specific UNIX print-spooler software. This allows label printing using "normal" print commands, rather than invoking slap directly. The UNIX print-spooler also enables the printer to be shared across a network.

Configuring the UNIX print-spooler for a Smart Label Printer is quite easy to do (sample scripts are provided with the distribution). The examples below are all designed to provide the following behaviour:


Serial Ports under UNIX

Some UNIX systems have distinct serial-port device-files for incoming (login) use and for outgoing (call-up) use. When using a Smart Label Printer on such systems, you should specify the "call-up" device-file rather than the "login" one. For instance:

Solaris 2.x:  /dev/cua/a /dev/cua/b /dev/cua/0 etc
Linux (kernel < 2.2):  /dev/cua0 /dev/cua1 etc
Linux (kernel >= 2.2):  /dev/ttyS0 /dev/ttyS1 etc
DYNIX/ptx 2.0:  /dev/cua/0 /dev/cua/1 etc
SunOS 4.1.3:  /dev/cua0 /dev/cua1 etc
IRIX 5.3:  /dev/ttym1 /dev/ttym2 etc

When configuring the print-spooler, there is no need to specify the serial-port baud-rate or other stty/termios settings. slap always hunts for the printers' current baud rate (and switches the printer to its' fastest workable baud rate); and always explicitly sets the stty/termios modes needed to communicate with the printer.


System V Release 4 (lpsched and lp)

NOTE:  this also applies to the "SunSoft Print Server" package that optionally replaces the SVR4 software for Solaris 2.4, 2.5 and 2.5.1, and comes as standard with Solaris 2.6.

  1. create a new "printer-interface" script from the template

    A template SVR4 "printer-interface" script is installed with the rest of the software, as install-dir/lib/slapf.svr4.

    Edit this script, and change the label-size, thus:

    	MEDIA=label-type
    
    The available label-types are listed in the manpage.

    You may also need to change the setting of BAUDMAP: see the comments in the script.

    Save your changes in another file, such as install_dir/lib/queue-name.pi.

  2. create the print-queue

    	lpadmin -p queue-name -I simple -T vanilla \
    		-i install-dir/lib/queue-name.pi \
    		-o nobanner -v port
    
    where port is the name of the serial-port device to which the printer is attached, install-dir is the directory where slap was installed, and queue-name is the name of the printer.

    NOTE: you do not need to specify the "-o stty=..." option.

    There are esoteric facilities (custom alerts, printer-classes, etc) that can be specified with other options - see your system documentation, or the manpage for lpadmin.

By default, the provided printer-interface program prints a one-label banner page for each print-job, unless the "-onobanner" flag is given on the lp command-line. This default can be changed by editing slapf.svr4: change "printbanner=yes" to be "printbanner=no".

When submitting print-jobs with lp, you can specify the font to use on the command line, eg:

	lp -d sl1 -o font=thames-bold-italic-24  file1.txt
The available fonts are listed in the manpage.

System V Release 3 (lpsched and lp)

  1. create a new "printer-interface" script from the template

    A template SVR3 "printer-interface" script is installed with the rest of the software, as install-dir/lib/slapf.svr3.

    Edit this script, and change the label-size, thus:

    	MEDIA=label-type
    
    The available label-types are listed in the manpage.

    You may also need to change the setting of BAUDMAP: see the comments in the script.

    Save your changes in another file, such as install_dir/lib/queue-name.pi.

  2. create the print-queue

    	lpadmin -p queue-name \
    		-i install-dir/lib/queue-name.pi \
    		-v port
    
    where port is the name of the serial-port device to which the printer is attached, install-dir is the directory where slap was installed, and queue-name is the name of the printer.
By default, the provided printer-interface program prints a one-label banner page for each print-job, unless the "-onobanner" flag is given on the lp command-line. This default can be changed by editing slapf.svr3: change "printbanner=yes" to be "printbanner=no".

When submitting print-jobs with lp, you can specify the font to use on the command line, eg:

	lp -d sl1 -o font=thames-bold-italic-24  file1.txt
The available fonts are listed in the manpage.

Note that the "out-of-labels" printer-status will be reported to the user by mail, rather than being made visible in the output of lpstat. The latter seems to be impossible under the SVR3 spooler.


BSD (lpr and lpd)

  1. create a new "input-filter" script from the template

    A template shell-script filter is provided as install-dir/lib/slapf.bsd.

    Edit this script, and change the font selection and label-size, thus:

    	FONT=font-name
    	...
    	MEDIA=label-type
    
    The available font-names and label-types are listed in the manpage.

    You may also need to change the setting of BAUDMAP: see the comments in the script.

    Save your changes in another file, such as install_dir/lib/queue-name.if.

  2. create the print-queue

    Add the following entry to /etc/printcap:
    queue-name:\
    	:lp=port:rw:\
    	:if=install-dir/lib/queue-name.if:\
    	:sf:sb:sh:sd=spool-directory:
    
    
    where port is the name of the serial-port device to which the printer is attached, install-dir is the directory where slap was installed, and queue-name is the name of the printer. Spool-directory is as described in your local lpd manpage.

    NOTE: you should not need to specify any of the :br:fc:fs:xc:xs: options in the printcap entry.

Unlike System V UNIX, the standard BSD print commands do not allow you to specify arbitrary per-job print-options, such as selecting the typeface or font size.

A common "fix" for this shortcoming is to define several logical printers all pointing to the same physical device, but each defined with a different input filter.

There are several other "fixes" for this LPD design flaw, including using another print-spooler altogether (such as LPRng). See the newsgroups, mailing-lists, et al.

Depending on your version of "lpd", printer errors such as "not responding", "out of labels" or "label jammed" may be reported to the console, to the user's terminal or even via "syslog". You can direct these messages to a specific named file or device by adding an :lf=path: element to the printcap entry for the printer.


LPRng

The above "BSD" method works with older releases of LPRng, too.

Newer releases of LPRng require some additional steps (thanks to Gregory Borzecki for these instructions):

LPRng has many more capabilities, thus a more specific method for integrating slap with LPRng would be worth doing.


previous up (powered by m4) home mail me