Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
  Previous   Contents   Next 
   
 
Chapter 7

Customizing the LP Print Service (Tasks)

This chapter provides background information and procedures for customizing the LP print service.

This is a list of the step-by-step instructions in this chapter.

For overview information about printers, see Chapter 2, Managing Printing Services (Overview).

Adjusting Printer Port Characteristics

The printer port characteristics set by the LP print service must be compatible with the printer communication settings. If the default printer port settings provided by the LP print service do not work with a printer, refer to the printer manual from the manufacturer to find out what settings the printer requires from the LP print service. Use the stty command to set and display printer communication settings.

The following table shows the default stty settings used by the LP print service.

Table 7-1 stty Default Settings Used by the LP Print Service

Option

Meaning

-9600

Set baud to 9600

-cs8

Set 8-bit bytes

-cstopb

Send one stop bit per byte

-parity

Do not generate parity

-ixon

Enable XON/XOFF (also known as START/STOP or DC1/DC3)

-opost

Do "output post-processing" using all the settings that follow in this table

-olcuc

Do not map lowercase to uppercase

-onlcr

Change line feed to carriage return/line feed

-ocrnl

Do not change carriage returns into line feeds

-onocr

Output carriage returns even at column 0

-n10

No delay after line feeds

-cr0

No delay after carriage returns

-tab0

No delay after tabs

-bs0

No delay after backspaces

-vt0

No delay after vertical tabs

-ff0

No delay after form feeds

How to Adjust the Printer Port Characteristics

  1. Log in as superuser, lp, or assume an equivalent role on the print server.

  2. Adjust the printer port characteristics.

    # lpadmin -p printer-name -o "stty=options"

    -p printer-name

    Name of the printer for which you are adjusting the port characteristics.

    -o "stty=options"

    Sets the port characteristic (stty option) specified by options.You can change more than one stty option setting with this command. Enclose each option in single quotation marks and use a space to separate the options. For a complete list of options, see stty(1). Table 7-1 shows the default stty settings used by the LP print service.

  3. Verify that the printer port characteristics have been changed.

    # stty -a

Examples--Adjusting the Printer Port Characteristics

The following example shows how to set the port characteristics for the printer luna. The parenb option enables parity checking/generation, parodd sets odd parity generation, and cs7 sets the character size to 7 bits.

# lpadmin -p luna -o "stty='parenb parodd cs7'"

The following example shows how to set the terminal baud rate to 19200 for the printer venus.

# lpadmin -p venus -o "stty=19200"

Adding a terminfo Entry for an Unsupported Printer

The LP print service uses an interface program and the terminfo database to initialize each printer and establish a selected page size, character pitch, line pitch, and character set.

Each printer is identified in the terminfo database with a short name. The name required by the terminfo database is identical to the name used to set the TERM shell variable. This name is also the printer type you specify when setting up a printer. For example, the entries for different types of PostScript printers are in the /usr/share/lib/terminfo/P directory. The default entries provided with the SunOS release are PS (for PostScript) and PSR (for PostScript Reverse).

If you cannot find a terminfo entry for your printer, you still might be able to use the printer with the LP print service without the automatic selection of page size, pitch, and character sets. However, you might have trouble keeping the printer set in the correct modes for each print request.

If there is no terminfo entry for your type of printer and you want to keep the printer set in the correct modes, you can either customize the interface program used with the printer or add an entry to the terminfo database. A terminal or printer entry in the terminfo database contains and defines hundreds of items. The LP print service, however, uses fewer than 50 of these items. The following table lists the required terminfo items for a printer.

Table 7-2 Required terminfo Items for a Printer

Item

 

Meaning

Booleans:

 

 

 

cpix

Changing character pitch changes resolution

 

daisy

Printer requires an operator to change character set

 

lpix

Changing line pitch changes resolution

Numbers:

 

 

 

bufsx

Number of bytes buffered before printing

 

cols

Number of columns in a line

 

cps

Average print rate in characters per second

 

it

Tabs initially every n spaces

 

lines

Number of lines on a page

 

orc

Horizontal resolution, in units per character

 

orhi

Horizontal resolution, in units per inch

 

orl

Vertical resolution, in units per line

 

orvi

Vertical resolution, in units per inch

Strings:

 

 

 

chr

Change horizontal resolution

 

cpi

Change number of characters per inch

 

cr

Carriage return

 

csnm

List of character set names

 

cudl

Down one line

 

cud

Move carriage down n lines

 

cuf

Move carriage right n columns

 

cvr

Change vertical resolution

 

ff

Page eject

 

hpa

Horizontal position absolute

 

ht

Tab to next 8-space tab stop

 

if

Name of initialization file

 

iprog

Path name of initialization program

 

is1

Printer initialization string

 

is2

Printer initialization string

 

is3

Printer initialization string

Strings:

 

 

 

lpi

Change number of lines per inch

 

mgc

Clear all margins (top, bottom, and sides)

 

rep

Repeat a character n times

 

rwidm

Disable double-wide printing

 

scs

Select character set

 

scsd

Start definition of a character set

 

slines

Set page length to n lines per page

 

smgl

Set left margin at current column

 

smglp

Set left margin

 

smgr

Set right margin at current column

 

smgrp

Set right margin

 

smglr

Set both left and right margins

 

msgt

Set top margin at current line

 

smgtp

Set top margin

 

smgb

Set bottom margin at current line

 

smgbp

Set bottom margin

 

smgtb

Set both top and bottom margins

 

swidm

Enable double-wide printing

 

vpa

Vertical position absolute

 
 
 
  Previous   Contents   Next