System Administration Guide

Part X Managing Printing Services

This part provides instructions for managing printing services in the Solaris environment. This part contains these chapters.

Chapter 39, Print Management (Overview)

Provides overview information for managing printing services on a network. This chapter provides information on print servers, print clients, and the LP print service.  

Chapter 40, Planning Printers on Your Network (Overview)

Provides overview information for planning printing services on a network, which includes information on allocating system resources and defining printers on a network. 

Chapter 41, Setting Up Printers (Tasks)

Provides step-by-step instructions for setting up a printer on a system and making it available to other systems on the network.  

Chapter 42, Administering Printers (Tasks)

Provides step-by-step instructions for administering printers, such as deleting printers, setting print policies, and managing print requests.  

Chapter 43, Managing Character Sets, Filters, Forms, and Fonts (Tasks)

Provides step-by-step instructions for setting up and maintaining character sets, print filters, forms, and fonts.  

Chapter 44, Customizing the LP Print Service (Tasks)

Provides step-by-step instructions for customizing the LP print service, such as adjusting printer port characteristics or adding a terminfo entry for a unsupported printer.

Chapter 45, LP Print Service Reference Information

 

Provides background information on the LP print service. 

Chapter 39 Print Management (Overview)

This chapter provides information about managing printers, print clients, and the LP print service. This is a list of the overview information in this chapter.

For step-by-step instructions on print management tasks, see:

What's New In Printing

The Solaris 2.6 print software offers a better centralized print administration than the LP print software in previous Solaris releases. With the Solaris 2.6 release, you can easily set up and manage print clients using the NIS or NIS+ name services.

Solaris 2.6 print software features include:

The Solaris 2.6 print software limitations include:

Redesign of Print Packages

The Solaris 2.6 print packages have been redesigned to provide greater flexibility and modularity of print software installation and to allow installation of a smaller print client footprint.

Redesign features include:

Table 39-1 describes the new set of print packages.

Table 39-1 Solaris 2.6 Print Packages

Package Instance 

Package Name 

Base Directory 

SUNWpcr

SunSoft Print - Client 

root (/)

SUNWpcu

SunSoft Print - Client 

usr

SUNWpsr

SunSoft Print - LP Server 

root (/)

SUNWpsu

SunSoft Print - LP Server 

usr

SUNWpsf

Postscript Filters 

usr

SUNWscplp

SunSoft Print - Source Compatibility 

usr

The removed print packages are:

Print commands contained in SUNWscpu have been moved and placed into SUNWscplp (SunSoft Print - Source Compatibility).

Print Protocol Adaptor

The Solaris 2.6 print protocol adaptor replaces the Service Access Facility (SAF), the network listener, and lpNet on the inbound side of the LP spooler with a more modular, modern design.

This replacement provides the following features:

The new print protocol adaptor is compatible with print clients set up in previous Solaris 2.x releases if the "BSD" protocol was used to configure these clients. If not, you'll have to modify the previous Solaris 2.x print client configuration to use the "BSD" protocol using AdmintoolTM, Solstice Printer Manager, or the lpsystem command.

SunSoft Print Client

The SunSoft Print Client software was previously released as an unbundled product. It was available on the Solaris Migration CD and as part of the AdminSuite 2.x suite of administration products. It is now bundled with the Solaris 2.6 release.

The SunSoft Print Client software uses a NIS map, NIS+ table, or a single file to provide centralized client administration in the Solaris 2.6 release. Features of the Print Client software include:

Enhanced Network Printer Support

The Solaris 2.6 print software provides better support for network printers in previous Solaris releases. Features include:

See Chapter 41, Setting Up Printers (Tasks)or the Solstice AdminSuite 2.3 Administration Guide for more information about setting up a network printer.

Printing in the Solaris 2.6 Environment

The Solaris 2.6 printing software provides an environment for setting up and managing client access to printers on a network.

The Solaris 2.6 printing software contains these components:

Table 39-2 summarizes the features of the Solaris 2.6 printing components.

Table 39-2 Solaris 2.6 Printing Component Features

Component 

Graphical User Interface? 

Set Up Print Clients? 

Manage Print Clients and Servers? 

Using NIS or NIS+? 

SunSoft Print Client 

No 

Yes 

No 

Yes 

Admintool 

Yes 

Yes 

Yes 

No 

LP commands  

No 

Yes 

Yes 

No 

Solstice AdminSuite 

Yes 

Yes 

Yes 

Yes 


Note -

If you do not use Solstice Printer Manager to set up and manage printing, you will have to use some combination of the other components to completely manage printing in the Solaris 2.6 environment.


Choosing a Method to Manage Printers

The Solaris 2.6 print client software and the Printer Manager application in SolsticeTM AdminSuiteTM offer a graphical solution for setting up and managing printers on a network. The advantage of the Solaris 2.6 print client software is that it supports a name service (NIS or NIS+), which enables you to centralize print administration for a network. lpadmin can also be used on the command line to configure printers on individual systems.

Admintool(TM) provides an alternative method to install printers in the Solaris environment. Admintool is a graphical user interface that simplifies tasks for setting up and managing printers. See Chapter 41, Setting Up Printers (Tasks) for step-by-step instructions on using Admintool.

You must run Admintool on the system to which you have attached the printer, because Admintool does not enable you to make changes to a remote system. When setting up a printer, Admintool makes the appropriate changes in the system's /etc/printers.conf and /etc/lp directory as required. You can use Admintool to set up a system as a print server or print client only if it is running the SunOS 5.x operating system. Setting up SunOS 4.x print servers and clients is fully described in the SunOS 4.x documentation.

Most of your needs for setting up printing services should be met by Admintool. However, if you have special needs, such as writing scripts, you may want to use the LP print service commands (which underlie Admintool) directly. The setup process with commands is described in "How to Add Access on the Print Client using LP Commands".

Use Table 39-3 to find printer setup information.

Table 39-3 Where To Find Printer Setup Information

For Information On ... 

See ... 

Setting up print clients and print servers using Admintool 

Chapter 41, Setting Up Printers (Tasks)

Setting up printer information available to print clients using a name service 

Chapter 41, Setting Up Printers (Tasks)

Setting up network printers using the LP commands 

Chapter 41, Setting Up Printers (Tasks)

Setting and managing printing (including network printers) using Solstice Printer Manager 

Solstice AdminSuite 2.3 Administration Guide

Administering printers using the LP commands 

Chapter 42, Administering Printers (Tasks)

The LP Print Service

The LP print service is a set of software utilities that allows users to print files while they continue to work. Originally, the print service was called the LP spooler. (LP stood for line printer, but its meaning now includes many other types of printers, such as laser printers. Spool is an acronym for system peripheral operation off-line.)

The print service consists of the LP print service software and spooler, which includes the Sunsoft Print Client software; any print filters you may provide; and the hardware (the printer, system, and network connections).

See Chapter 45, LP Print Service Reference Information for background information about the LP print service.

Other LP print service topics covered in this part and their chapter references are described below.

Managing Network Printers

A network printer is a hardware device that provides printing services to print clients without being directly cabled to a print server. It has its own system name and IP address, and is connected directly to the network.

Network printers often have software support provided by the printer vendor. If your printer has printer vendor supplied software it is strongly advised that the printer vendor software be utilized. If the network printer vendor does not provide software support, the Sun supplied software is available. This software provides generic support for network printers and is not capable of providing full access to all possible printer capabilities.

See Chapter 41, Setting Up Printers (Tasks) for step-by-step instructions on setting up a network printer.

Administering Printers

After you set up print servers and print clients, there are a number of administration tasks you may need to perform frequently:

See Chapter 42, Administering Printers (Tasks), for step-by-step instructions on how to perform the printer administration tasks.

Setting Definitions for Printers

Establishing definitions for the printers on your network is an ongoing task that lets you provide a more effective print environment for users. For example, you can assign printer descriptions for all your site's printers to help users find where a printer is located, or you can define a class of printers to provide the fastest turnaround for print requests.

See Chapter 40, Planning Printers on Your Network (Overview) for information on setting up printer definitions.

Administering Character Sets, Filters, Forms, and Fonts

Depending on your site's requirements and the types of printers you have on the network, you may have to set up and administer printer-specific features of the LP print service. For example, you can assign different print wheels, filters, and forms to different printers. See Chapter 43, Managing Character Sets, Filters, Forms, and Fonts (Tasks) for background information and step-by-step instructions on how to set up and administer character sets, print filters, forms, and fonts.

Customizing the LP Print Service

Although the LP print service is designed to be flexible enough to handle most printers and printing needs, it does not handle every possible situation. You may have a printing request that is not accommodated by the standard features of the LP print service. Or you may have a printer that does not quite fit into the way the LP print service handles printers.

You can customize the LP print service in the following ways:

See Chapter 44, Customizing the LP Print Service (Tasks), for detailed descriptions and step-by-step instructions to customize the LP print service.

Using the SunSoft Print Client Software

This section provides an overview of how the SunSoft Print Client software works.

The SunSoft Print Client Process

Figure 39-1 illustrates the path of a print request from the time the user initiates the request until it is printed.

Figure 39-1 Overview of the SunSoft Print Client Process

Graphic

  1. A user submits a print request from a SunSoft print client by using a SunSoft print client command.

  2. The print client command checks a hierarchy of print configuration resources to determine where to send the print request.

  3. The print client command sends the print request directly to the appropriate print server. A print server can be any server that accepts BSD printing protocol, including SVR4 (LP) print servers and BSD print servers (such as the SunOS 4.x BSD print server).

  4. The print server sends the print request to the appropriate printer.

  5. The print request is printed.

SunSoft Print Clients

This section of the overview focuses on the print client, a system that can send print requests to a print server, and print commands, which enable the print client to initiate print requests.

Figure 39-2 highlights the part of the print process in which the user submits a print request from a SunSoft print client.

Figure 39-2 The User Submits a Print Request from a SunSoft Print Client

Graphic

What Is a SunSoft Print Client?

A system becomes a SunSoft print client when you install the SunSoft print client software and enable access to remote printers on the system. The SunSoft print client commands have the same names and produce the same output as the print commands of the previous Solaris releases.

How the SunSoft Print Client Commands Improve the Print Process

With the Solaris 2.6 SunSoft print client commands, the client system becomes a more effective print client: the commands use a greater number of options to locate printer configuration information, and the client communicates directly with the print server. In the previous Solaris operating environment, the print client did not have these advantages.

The Solaris 2.6 SunSoft print client commands:

Printer Configuration Resources

This section describes the resources that the SunSoft print client commands use to locate printer names and printer configuration information.

The SunSoft print client commands can use a name service, which is a network (shared) resource for storing printer configuration information for all printers on the network. The name service (NIS or NIS+) simplifies printer configuration maintenance: When you add a printer in the name service, all SunSoft print clients on the network can access it.

Figure 39-3 highlights the part of the print process in which the SunSoft print client commands check a hierarchy of printer configuration resources to determine where to send the print request.

Figure 39-3 The SunSoft Print Client Checks Resources to Locate Printers

Graphic

How the SunSoft Print Client Software Locates Printers

As shown in Figure 39-4, the SunSoft print client commands use more options to locate printers and printer configuration information.

Figure 39-4 How the SunSoft Print Client Software Locates Printers

Graphic

  1. A user submits a print request from a SunSoft print client by using the lp or lpr command. The user can specify a destination printer name or class in any of three styles:

    • Atomic style, which is the print command and option followed by the printer name or class, as shown in this example.


      % lp -d neptune filename
      
    • POSIX style, which is the print command and option followed by server:printer, as shown in the following example.


      % lpr -P galaxy:neptune filename
      
    • Context-based style, as defined in the Federated Naming Service Guide in the Solaris 2.6 Software Developer AnswerBook, shown in this example.


      % lpr -d thisdept/service/printer/printer-name filename
      
  2. The print command locates a printer and printer configuration information as follows:

    • It checks to see if the user specified a destination printer name or printer class in one of the three valid styles.

    • If the user didn't specify a printer name or class in a valid style, the command checks the user's PRINTER or LPDEST environment variable for a default printer name.

    • If neither environment variable for the default printer is defined, the command checks the .printers file in the user's home directory for the _default printer alias.

    • If the command does not find a _default printer alias in the .printers file, it then checks the SunSoft print client's /etc/printers.conf file for configuration information.

    • If the printer is not found in the /etc/printers.conf file, the command checks the name service (NIS or NIS+), if any.

These are the advantages of the SunSoft Print Client method to locate printers:

Who Should Use a Name Service

A name service provides the most efficient way to add, modify, and delete printer configuration information for a network. Almost every site can benefit significantly from using a name service. One exception might be a very small network with only a few printers and print clients.

SunSoft Print Servers

This section of the overview focuses on the print server, a system that has a local printer connected to it and makes the printer available to other systems on the network. Figure 39-5 highlights the part of the SunSoft print process in which the print server sends the print request to the printer.

Figure 39-5 The SunSoft Print Server Sends a Print Request to the Printer

Graphic

The BSD Printing Protocol

The Solaris 2.6 SunSoft print client commands use the BSD printing protocol. One of the big advantages of this protocol is that it can communicate with a variety of print servers:

The BSD printing protocol is an industry standard. It is widely used and it provides compatibility between different types of systems from various manufacturers. Sun has chosen to support the BSD printing protocol to provide interoperability in the future.

Where to Go From Here

Go to Chapter 41, Setting Up Printers (Tasks) for step-by-step instructions on:

If you need printer planning information, see Chapter 40, Planning Printers on Your Network (Overview).

Chapter 40 Planning Printers on Your Network (Overview)

The goal of setting up printers on a network is to give users access to one or more printers. This section provides information about distributing printers across your network to gain the best efficiency and about planning for printer setup.

For step-by-step instructions on print management tasks, see:

Distributing Printers on the Network

As an administrator, you must determine whether each printer would be best used if it is dedicated to one system or available to many systems. In a network environment, it usually works best to distribute your printers on several print servers. The advantage of setting up several print servers is that when one print server has a problem, you can route print requests to other print servers.

If you use a centralized print configuration, you can still connect printers to users' systems for convenience or for improved response. A printer that is connected to a user's system is still available to other systems on the network.

Figure 40-1 shows an example of how you can have a centralized print configuration and still connect printers to users' systems.

Figure 40-1 How to Distribute Printers on a Network

Graphic

Assigning Print Servers and Print Clients

You must decide which systems will have local printers physically attached to them, and which will systems use printers on other systems. A system that has a local printer attached to it and makes the printer available to other systems on the network is called a print server. A system that sends its print requests to a print server is called a print client.

The LP print service software manages printing services in the Solaris environment. Besides physically connecting a printer to a system, you must define the printer characteristics to the LP print service and make the system a print server. Once you have print servers set up, you can set up other systems as print clients.

Print servers and print clients can run different versions of the SunOS operating system. Systems running the SunOS 5.x operating system can print to existing print servers running the SunOS 4.x operating system, and systems running the SunOS 4.x operating system can print to print servers running the SunOS 5.x operating system.


Note -

SunOS 5.x is part of the Solaris 2.x operating environment.


Figure 40-2 shows example print configurations on a network with systems running the SunOS 5.x and 4.x operating systems.

Figure 40-2 Example Print Configurations on SunOS 5.x and 4.x Systems

Graphic

Print Server Requirements and Recommendations

You can attach a printer to a standalone system or to any system on the network. Any networked system with a printer can be a print server, as long as the system has adequate resources to manage the printing load.

Spooling Space

Spooling space is the amount of disk space that is used to store and process requests in the print queue. Spooling space is the single most important factor to consider when deciding which systems to designate as print servers. When users submit files for printing, the files are stored in the /var/spool/lp directory until they have been printed. The size of the /var directory depends on the size of the disk and how the disk is partitioned. Spooling space may be allocated in the /var directory on the print server hard disk, or mounted from a file server and accessed over the network.


Note -

If /var is not created as a separate file system, the /var directory uses space in the root (/) file system, which is likely to be insufficient.


Disk Space

When evaluating systems as possible print servers, consider their available disk space. A large spool directory can consume 600 Mbytes of disk space. Look at the size and division of disk space on systems that can be designated as print servers.

Also, carefully evaluate the printing needs and use patterns of print client systems. If users in a small group typically print only short email messages-- simple ASCII files without sophisticated formatting requirements--a print server with 20 to 25 Mbytes of disk space allocated to /var is probably sufficient. If, however, many print client users are printing large documents or bit-mapped or raster images, they will likely fill up the spooling space quite frequently. When users cannot queue their jobs for printing, work flow is interrupted. Requests for more spooling space may force you to either add disk space for spooling or designate a different system as the print server.

If the print server has a /var directory that resides in a small partition, and if a large amount of disk space is available elsewhere, you can use that space as spooling space by mounting it on the /var directory on the print server. See Chapter 28, Mounting and Unmounting File Systems (Tasks) for information about mounting file systems and editing the vfstab file.

Memory

The Solaris environment requires a minimum of 16 Mbytes of memory to run. A print server does not require additional memory. However, you may find that more memory improves performance in filtering print requests.

Swap Space

The swap space allocation on the print server should be sufficient to handle LP print service requirements. See Chapter 30, Configuring Additional Swap Space (Tasks) for information about how to increase swap space.

Hard Disk

For optimal performance, the print server should have a hard disk and a local /var directory. You should mount spooling space for a print server on a local hard disk. If a print server has its own hard disk and a local /var directory, printing is much faster, and you can more accurately predict the time needed to process print requests.

Planning for Printer Setup

This section provides an overview of planning for printing in the Solaris environment that includes:

Setting Definitions for Printers

Establishing definitions for the printers on your network is an ongoing task that lets you provide a more effective print environment for users. For example, you can assign parameters for all your site's printers to help users find where a printer is located, or you can define a class of printers to provide the fastest turnaround for print requests.

The lpadmin command lets you set all of the print definitions, while Admintool lets you set only some of them when you install or modify a printer. Table 40-1 lists the print definitions and shows whether you can assign the definition with Admintool.

Table 40-1 Print Definitions Set With Admintool

Print Definition 

Can You Set It With Admintool? 

Printer name

Yes 

Printer description

Yes 

Printer port

Yes 

Printer type

Yes 

File contents

Yes, but with less functionality than the lpadmin command

Fault notification

Yes, but with less functionality than the lpadmin command

Default printer destination

Yes 

Printing banner pages

Yes, but with less functionality than the lpadmin command

Limiting user access to a printer

Yes, but with less functionality than the lpadmin command

Printer class

No 

Fault recovery

No 

Printer Name

When adding a printer to a system, you specify a printer name for the printer. A printer name must be:

Establish a naming convention that works for your site. For example, if you have different types of printers on the network, including the printer type as part of the printer name can help users choose an appropriate printer. For instance, you could identify PostScriptTM printers with the letters PS. If, however, all of the printers at your site are PostScript printers, you would not need to include the initials PS as part of the printer name.

Printer Description

You can assign a description to a printer by using the lpadmin -D command or Admintool. The printer's description should contain information to help users identify the printer. You might include the room number where the printer is located, the type of printer, the manufacturer, or the name of the person to call if there are printing problems.

Users can look at a printer description by using the following command:


$ lpstat -D -p printer-name

Printer Port

When you install a printer or later change its setup, you can specify the device, or the printer port, to which the printer is connected, by using Admintool or the lpadmin -p printer-name -v device-name command.

Most systems have two serial ports and a parallel port. Unless you add ports, you cannot connect more than two serial printers and a parallel printer to one system.

With Admintool, you can select either /dev/term/a or /dev/term/b, or choose Other and specify any port name that the print server recognizes. These options give you as much flexibility as the lpadmin command.

The LP print service initializes the printer port using the settings from the standard printer interface program. See "Managing Print Filters" for more information about printer interface programs. If you have a parallel printer or a serial printer for which the default settings do not work, see "Adjusting Printer Port Characteristics" for information about customizing the port settings.


Note -

If you use multiple ports on an x86 system microprocessor-based system, only the first port is enabled by default. The second and any subsequent ports are disabled by default. To use more than one port, you must manually edit the device driver port configuration file for each additional asy (serial) port or lp (parallel) port. The pathnames for the x86 port configuration files are:

/platform/i86pc/kernel/drv/asy.conf

/platform/i86pc/kernel/drv/lp.conf

See the Information Library for Solaris 2.6 (Intel Platform Edition) for information about configuring serial and parallel ports on x86 systems.


Printer Type

The printer type is a generic name for a type of printer. It identifies the terminfo database entry that contains various control sequences for the printer. By convention, printer type is usually derived from the manufacturer's model name. For example, the printer type name for the DECwriter(TM) printer is decwriter. However, the common printer type PS does not follow this convention. PS is used as the printer type for many models of PostScript printers, such as LaserWriter\256I and LaserWriterII printers.

You can specify the printer type by using the lpadmin -T command or Admintool. With Admintool, you can specify the printer type only when you are installing a printer. If you want to change the type of an existing printer, you must delete the printer and reinstall it by using Admintool, otherwise change the printer type by using the lpadmin command.

Admintool lets you select a printer type from a menu or choose Other and specify any printer type in the terminfo database. This provides you as much capability as the lpadmin command.

Printer Names in the terminfo Database

Information about each printer type is stored in the terminfo database (/usr/share/lib/terminfo). This information includes the printer capabilities and initialization control data.The printer you install must correspond to an entry in the terminfo database.


$ pwd
/usr/share/lib/terminfo
$ ls
1   4   7   A   M   a   d   g   j   m   p   s   u   x
2   5   8   B   P   b   e   h   k   n   q   t   v   y
3   6   9   H   S   c   f   i   l   o   r   ti  w   z
$ 

Each subdirectory contains compiled database entries for terminals or printers. The entries are organized by the first letter of the printer or terminal type. For example, if you have an Epson\256 printer, look in /usr/share/lib/terminfo/e to find your particular model of Epson printer.


$ cd /usr/share/lib/terminfo/e
$ ls
emots        ep2500+high  ep48           ergo4000    exidy2500
env230       ep2500+low   epson250       esprit
envision230  ep40         epson2500-80   ethernet
ep2500+basic ep4000       epson2500-h    ex3000
ep2500+color ep4080       epson2500-hi8  exidy
$ 

The entries for Epson printers are included in the preceding example.

If you have a NEC\256 printer, look in the /usr/share/lib/terminfo/n directory for your NEC printer model.


$ cd /usr/share/lib/terminfo/n
$ ls
ncr7900        ncr7901        netty-Tabs     newhpkeyboard
ncr7900-na     nec            netty-vi       nuc
ncr7900i       net            network        nucterm
ncr7900i-na    netronics      netx
ncr7900iv      netty          newhp
$ 

The entry in this directory for NEC is included in the preceding example.

Selecting a Printer Type

For a local PostScript printer, use a printer type of either PostScript (PS) or Reverse PostScript (PSR). If your printer supports PostScript, choose PS or PSR even if the specific printer type is listed in the terminfo database.

If your PostScript printer prints pages face up, documents appear to be printed backwards--the first page is at the bottom of the stack and the last page is on the top. If you specify the printer's type as PSR, the LP print service reverses the order of the pages before sending them to the printer; the last page is printed first, and the pages are stacked in forward order. However, the LP print service can reliably change the page order only for PostScript files that conform to the Adobe\256 Document Structuring Conventions in Appendix C of the PostScript Language Reference Manual (written by Adobe Systems Incorporated, and published by Addison-Wesley, 1990).

If a printer can emulate more than one kind of printer, you can assign it several types by using the lpadmin -T command. If you specify more than one printer type, the LP print service uses the type that is appropriate for each print request.

You may not find the printer type in the appropriate terminfo directory. The type of printer is not necessarily linked to the manufacturer's name on the printer. For example, for any type of PostScript printer, you can use the PS or PSR entry (found in the /usr/share/lib/terminfo/P directory) instead of an entry specific to manufacturer or product names.

If you have an unusual type of printer, you may need to try different entries before you can determine whether a particular terminfo entry works for your model of printer. If possible, find an entry in the terminfo database that works for your printer. It will be much easier than trying to create an entry. If you have to create your own entry, "Adding a terminfo Entry for an Unsupported Printer" contains some useful tips.

Selecting a File Content Type

Print filters convert the content type of a file to a content type that is acceptable to the destination printer. The file content type tells the LP print service the type of file contents that can be printed directly, without filtering. To print without filtering, the necessary fonts must also be available in the printer. (You must set up and use filtering for other types of files.)

You can specify the file content type for a printer by using the lpadmin -I command or Admintool. With Admintool, you can select a file contents type from a menu. Not all available file content types are listed on the menu. You must use the lpadmin command to specify file content types that are not included on the Admintool menu.

Many printers can print two types of files directly:

When submitting a file for printing, the user can indicate the content type of the file (lp -T content-type). Otherwise, a file is assumed to be simple (ASCII text). The LP print service uses the file content type to determine which filters to use to convert the file contents into a type the printer can handle.

Admintool provides a list of file content types from which you can choose when installing or modifying a local printer. The choices are translated to the names that the LP print service uses. Table 40-2 describes the file content types you can choose with Admintool.

Table 40-2 Choosing File Content Type With Admintool

File Contents Choice 

LP Print Service Name 

Description 

PostScript 

postscript

PostScript files do not require filtering. ASCII files require filtering. 

ASCII 

simple

PostScript files require filtering. ASCII files do not require filtering. 

Both PostScript and ASCII 

simple,postscript

PostScript files and ASCII files do not require filtering. 

None 

""

All files require filtering, except those matching the printer's type. 

Any 

any

No filtering required. If the printer cannot handle a file content type directly, the file will not be printed. 

Choose the file content type that best matches the printer's capabilities. PostScript (which means filtering is not needed for PostScript files) is the default choice in Admintool and is probably correct most of the time.

Frequently Used Printers

This section provides the printer type and file content type for the printers most commonly used with SunOS 5.x software. Although not shown, many of these printers can also directly print files with simple content type.

If you have a PostScript printer, use a printer type of PS or PSR and a content type of postscript. PSR reverses the pagination and prints the banner page last.

Table 40-3 lists additional non-PostScript printers and shows the printer type to use for configuring each printer. For all these printers, the file content type is simple.


Note -

Sun Microsystems does not supply filtering software for the printers listed in Table 40-3, among others. However, you can use unsupported printers if you supply filtering or if the printer can directly print the file content type. If you have questions about any printer for which Sun Microsystems does not supply filters, contact the printer manufacturer.


Table 40-3 Some Non-PostScript Printers for Which Sun Does Not Supply Filters

Printer 

Printer Type 

Daisy 

daisy

Datagraphix 

datagraphix

DEC LA100 

la100

DEC LN03 

ln03

DECwriter 

decwriter

Diablo 

diablo

 

diablo-m8

Epson 2500 variations 

epson2500

 

epson2500-80

 

epson2500-hi

 

epson2500-hi80

Hewlett-Packard HPCL printer 

hplaser

IBM Proprinter 

ibmproprinter

If you want to set up a printer that is not in the terminfo database, see "How to Add a terminfo Entry for an Unsupported Printer".

Chapter 41 Setting Up Printers (Tasks)

This chapter explains how to set up a printer and make it accessible to systems on the network. You can perform most printer setup tasks by using Admintool. This is a list of the step-by-step instructions in this chapter.

For overview information about printers, see Chapter 39, Print Management (Overview).

Updating SunSoft Print Clients to Access Existing Printers

This section explains how to convert the printer configuration information from SunOS 5.x and 4.x systems at your site and copy this information to SunSoft print clients so they can access existing printers.


Note -

If you have only a few existing printers, it may be easier to add access to the printers by using Solstice Printer Manager or Admintool rather than convert the printer configuration information and distribute it to print clients. See Table 41-2 information on adding access to printers.


Updating SunSoft Print Clients With Printer Information

Table 41-1 provides an overview of the tasks you perform to convert the printer configuration information from SunOS 5.x and 4.x systems at your site and distribute the information to SunSoft print clients so they can access existing printers.

Table 41-1 Task Map: Updating Sunsoft Print Clients to Access existing Printers
 

Task 

 

Description 

 

For Instructions, Go To 

 

Convert Existing Printer Configuration Information 

 

Convert Printer Configuration Information From a SunOS 5.x System.

If your site uses SunOS 5.x software, convert the printer configuration information in a 5.x system's /etc/lp/printers directory to the SunSoft /etc/printers.conf configuration file. This is usually a one-time task.

 

"How to Convert Printer Information From a SunOS 5.x System"

 
 

 

 

Convert Printer Configuration Information From a SunOS 4.x System.

If your site uses SunOS 4.x software, convert the printer configuration information in a 4.x system's /etc/printcap file to the SunSoft /etc/printers.conf configuration file. This is usually a one-time task.

 

"How to Convert Printer Information From a SunOS 4.x System"

        

Converting Existing Printer Configuration Information

Existing printer configuration information will automatically be converted when installing or upgrading to the Solaris 2.6 release. This section explains how to convert the printer configuration information from a SunOS 5.x or 4.x system to the /etc/printers.conf printer configuration file used in the SunSoft Print Client software. You'll use one of two print administration commands to automate the conversion task:

If you are not using a name service, you should create a master /etc/printers.conf file that includes the existing printers at your site. You can then copy the master file to all the SunSoft print clients or by loading it into NIS or NIS+. This is a good way to initially enable all the new SunSoft print clients access to the existing printers at your site.


Caution - Caution -

If you are using the NIS or NIS+ name service to configure printer information, do not use a /etc/printers.conf file on your SunSoft print clients. A SunSoft print client uses the /etc/printers.conf file first to locate a printer; however, the /etc/printers.conf file may conflict with the printer information in the NIS or NIS+ maps and cause unexpected results. To avoid this problem, remove the /etc/printers.conf file on SunSoft print clients when you want them to use NIS or NIS+ for printer information.


How to Convert Printer Information From a SunOS 5.x System

  1. Log in as superuser on a system that has SunOS 5.x software and SunSoft Print Client software installed.

  2. Convert the printer configuration information in the system's /etc/lp/printers directory to the /etc/printers.conf file.


    # /usr/lib/print/conv_lp
    

How to Convert Printer Information From a SunOS 4.x System

  1. Copy the /etc/printcap file from a SunOS 4.x system to a SunOS 5.x system that has the SunSoft Print Client software.

  2. Log in as superuser on the SunOS 5.x system to which you copied the /etc/printcap file.

  3. Convert the printer configuration information in the /etc/printcap file to the /etc/printers.conf file.


    # /usr/lib/print/conv_lpd
    

Setting Up Printing

"Setting Up Printing Task Map" provides an overview of the tasks necessary to set up print servers (Add a Printer) and print clients (Add Access to the Printer). A local printer is one which is physically cabled to the print server; a network printer is physically attached to the network. Adding access to a printer, or adding remote access, is the process of giving print clients (all those machines which are not the server) access to the printer.

Setting Up Printing Task Map

Table 41-2 Task Map: Setting Up Printing
 

Task 

 

Description 

 

For Instructions, Go To 

 

Add a Local Printer 

 

Using Admintool.

After physically attaching the printer to a system, use Admintool to make the printer available for printing.  

 

"How to Add a Local Printer Using Admintool"

 
 

 

 

Using LP Commands.

After physically attaching the printer to a system, use the LP commands to make the printer available for printing. 

 

"How to Add a Local Printer Using LP Commands"

        
 

Add Access to a Printer  

 

Using Admintool.

Add printer access on the print client using Admintool. 

 

"How to Add Printer Access on the Print Client Using Admintool"

 
 

 

 

Using LP Commands.

Add printer access on the print client using the lp commands. 

 

"How to Add Access on the Print Client using LP Commands"

 

 

 

Using a Name Service. Add printer access on the print client by setting up a /etc/printers.conf file in NIS or NIS+.

 

"Adding Access to a Remote Printer Using a Name Service"

          
 

Add Access to Existing Printers 

 

Copy a Master /etc/printers.conf File to Clients.

If you don't use a name service, copy the printer configuration information in the converted system's /etc/printers.conf file to other SunSoft print clients.

 

"Enabling Print Clients to Access Existing Printers"

   

Use the /etc/printers.conf File to Load NIS.

If you use NIS, copy the printer configuration information in the converted system's /etc/printers.conf file to the NIS master file.

"How to Use the /etc/printers.conf File to Load NIS"

   

Use the /etc/printers.conf File to Load NIS+.

If you use NIS+, copy the printer configuration information in the converted system's /etc/printers.conf file to the NIS master file.

"How to Use the /etc/printers.conf File to Load NIS+"

       

Set Up a .printers File

Optional.

Using a $HOME/.printers file enables users to establish their own custom printer aliases.

"Setting Up a .printers File"

         
 

Add a Network Printer 

 

Using Printer Vendor Supplied Tools.

After physically connecting the printer to the network, use vendor-supplied software to configure the network printer.  

 

"How to Add a Network Printer Using Printer Vendor Supplied Tools"

 

 

Using LP Commands After physically connecting the printer to the network, use SunSoft supplied software to configure the network printer.

"How To Add A Network Printer Using LP Commands"

         
 

Turn Off Banner Pages 

 

Optional.

You can turn off banner pages so they are never printed. 

 

"How to Turn Off Banner Pages"

 
       
 

Set Up Fault Alerts  

 

Optional.

You can set up more specific fault alerts for the printer than Admintool provides.  

 

"How to Set Fault Alerts for a Printer"

 
       
 

Set Up Fault Recovery 

 

Optional.

Admintool does not enable you to set up how a printer should recover after it faults.  

 

"How to Set Printer Fault Recovery"

 
       
 

Limit Access to the Printer  

 

Optional.

Admintool enables you to set up an allow list, but if you want to limit a few users' access to the printer, you may want to set up a deny list.  

 

"How to Limit User Access to a Printer"

 
        

How to Start Admintool

  1. Verify that the following prerequisites are met. To use the Admintool software, you must have:

    • A bit-mapped display monitor. The Admintool software can be used only on a system with a console that is a bit-mapped screen, such as a standard display monitor that comes with a Sun workstation.

    • Running an X Window System, such as the OpenWindows environment.

    • Membership in the sysadmin group (group 14).

  2. Log in on the system where you want to set up the printer.

  3. Start Admintool with the following command:


    $ admintool &
    

    The Admintool main window is displayed.

  4. Select Printers from the Browse menu.

    Graphic

    The Printers window is displayed.

Setting Up a Print Server

When you add a local printer and/or a network printer to a system, the printer is made accessible to the local system. The system on which you install the printer becomes the print server.

A printer can be added using either Admintool or the LP print service commands. The following describes how to use each of these.

How to Add a Local Printer Using Admintool

  1. Select the system which is to be the printer server.

    Verify that the print server has the following print packages installed by using the pkginfo command: SUNWpcr, SUNWpcu, SUNWpsr, SUNWpsu, SUNWscplp, and SUNWpsf.


    # pkginfo package_instance
    
  2. Connect the printer to the printer server and turn on the power to the printer.

    Consult the printer vendor's installation documentation for information about the hardware switches and cabling requirements.

  3. Start Admintool on the printer server where you connected the printer.

    See the procedure on "" for detailed information.

  4. Select Add Local Printer from the Edit menu.

    The Add Local Printer window is displayed.

  5. Fill in the window.

    If you need information to complete a field, click on the Help button to see field definitions for this window.

  6. Click on OK.

    The printer is displayed in the Admintool Printers window.

  7. Exit Admintool.

    Click on button in upper-left corner; select quit.

  8. Add client access to the new printer.

    Now that the printer has been added, create access to the printer for the clients. See "Setting Up a Print Client".

  9. Optional tasks to complete.

    There are several optional tasks you may want to complete when setting up a printer. See "Setting Up Printing Task Map" for pointers to the remaining tasks.

Example--Completed Add Local Printer Window

In the following example, the printer luna is added on the print server krypton.

Graphic

How to Add a Local Printer Using LP Commands

Adding a local printer may also be accomplished using the command line interface.

  1. Select the system which is to be the printer server.

    Verify that the print server has the following print packages installed by using the pkginfo command: SUNWpcr, SUNWpcu, SUNWpsr, SUNWpsu, SUNWscplp, and SUNWpsf.


    # pkginfo package_instance
    
  2. Connect the printer to the printer server and turn on the power to the printer.

    Consult the printer vendor's installation documentation for information about the hardware switches and cabling requirements.

  3. Set lp ownership and read/write access on the port device.


    # chown lp /dev/term/device
    # chmod 600 /dev/term/device
    
  4. Define the printer name, the device, the printer type and content type by using the lpadmin command.

    1. Define the printer name and the port device the printer will use.


      # lpadmin -p printer-name -v /dev/term/device 
      
    2. Set the printer type of the printer.


      # lpadmin -p printer-name -T printer-type 
      
    3. Specify the file content types of the printer.


      # lpadmin -p printer-name -I content-type
      
  5. Add filters to the print server by using the lpfilter command

    1. First, determine if the needed filters are installed.


      #	lpfilter -l -f all 
      

      If the filter is not installed, you will see the message:


      ERROR: No filter by the name "" exists.
    2. If you have determined that filter installation is needed, use the lpfilter command to install the filters.


      #	cd /etc/lp/fd
      # for filter in *.fd;do
          > name=`basename $filter .fd`
          > lpfilter -f $name -F $filter
          > done
       
      
  6. Allow the printer to accept printer requests and enable the printer to print the requests.


    #	accept printer-name
    #	enable printer-name
     
    
  7. Verify the printer is correctly configured by using the lpstat command.


    #	lpstat -p printer-name
     
    
  8. (Optional) Add a description to the printer.

    # lpadmin -p printer_name -D "description"
    
  9. Add client access to the new printer.

    Now that the printer has been added, create access to the printer for the clients. See "Setting Up a Print Client".

  10. Optional tasks to complete.

    There are several optional tasks you may want to complete when setting up a printer. See "Setting Up Printing Task Map" for pointers to the remaining tasks.

Example--Adding a Local Printer Using LP Commands

This example shows how to make a local PostScript printer available for printing on a print server. The commands in this example must be executed on the print server where the printer is connected. The following information is used in the example and may change depending on your situation:

Setting Up a Print Client

A print client is a system that is not the server for the printer, yet has access to the printer. A print client uses the services of the print server to spool, schedule and filter the print jobs. Note that one system may be a print server for one printer and be a print client for another printer.

Access to a remote printer may be configured on a domain-wide basis or on a per-machine basis. A combination of these two may also be used. To add access to a remote printer on a per machine basis see "How to Add Printer Access on the Print Client Using Admintool" or "How to Add Access on the Print Client using LP Commands". To add access on a domain wide basis, follow the instructions under "Adding Access to a Remote Printer Using a Name Service". See also printers.conf(4), printers(4), and lpset(1M).

How to Add Printer Access on the Print Client Using Admintool

  1. Start Admintool on the system where you want to add access to a remote printer.

    See the procedure on "" for detailed information.

  2. Select Add Access to Remote Printer from the Edit menu.

    The Add Access to Remote Printer window is displayed.

  3. Fill in the window.

    If you need information to complete a field, click on the Help button to see field definitions for this window.

  4. Click on OK.

    The printer is displayed in the Admintool Printers window.

  5. Exit Admintool.

    Click on button in upper-left corner; select quit.

Example--Adding Printer Access on the Print Client

In the following example, the print client rogue is given access to the printer rocket on the print server enterprise.

Graphic

How to Add Access on the Print Client using LP Commands

  1. Collect the required information.

    All that is required is the name of the printer and the name of the server for that printer.

  2. Define the printer by using the lpadmin command.

    # lpadmin -p printer_name -s server_name
    
  3. (Optional) Add a description to the printer.

    # lpadmin -p printer_name -D "description"
    
  4. Verify the printer is correctly configured by using the lpstat command.


    #	lpstat -p printer-name
     
    

Example--Adding Access on the Print Client using LP Commands

If you want to print to a remote printer, you must add access to the remote printer. This example shows how to configure access to a printer named luna, whose print server is saturn. The system saturn becomes a print client of the printer luna.


 [Identifies the printer and the print server.] # lpadmin -p luna -s saturn
 [Adds a description for the printer.] # lpadmin -p luna -D "Room 1954 ps"
 [Sets the printer as the system's default printer destination.] # lpadmin -d luna
 [Verifies that the printer is ready.] # lpstat -p luna
		printer luna is idle. enabled since Jun 24 18:30 1996. available.

Adding Access to a Remote Printer Using a Name Service

Using either the NIS or NIS+ maps, access to a printer may be obtained on a domain-wide basis. See nis+(1).

How to Add Domain-Wide Access to a Printer using NIS

On the NIS master server, run the lpset command to create a printers.conf file; then create and push the map. This gives all members of the domain access to the printers defined in the map. See lpset(1M).

  1. Become superuser on the NIS master server.

  2. Create a printers.conf file by using the lpset command for each printer.


    # lpset -a bsdaddr=server1,printer1,extensions printer1
    
    -a bsdaddr=server1,printer1,extensions
    

    Adds the print server, printer destination, and enables Solaris protocol extensions. 

    printer1

    Specifies the printer name. 

  3. Create and push the NIS map.


    # make -f /var/yp/makefile -f /usr/lib/print/Makefile.yp 
    printers.conf
    
    -f /var/yp/makefile

    Specifies the NIS makefile. 

    -f /usr/lib/print/Makefile.yp

    Specifies the NIS print makefile. This means implicit rules and predefined macros from both makefiles are concatenated. 

    printers.conf

    Specifies the file to be created or updated. 

Example--Adding Domain-Wide Access to a Printer using NIS

This example creates a printers.conf entry for the printer luna, connected to the print server, saturn. The make command pushes the printers.conf map.


# lpset -a bsdaddr=saturn,luna,Solaris -a description=
"Room 1954 ps" luna
# make -f /var/yp/makefile -f /usr/lib/print/Makefile.yp 
printers.conf

How to Add Domain-Wide Access to a Printer using NIS+

On the NIS+ master server, use the lpset command (see lpset(1M)) to add the printer configuration information to NIS+ via XFN (see fns(5)).

  1. Become superuser on the NIS+ master server.

  2. (Optional) If FNS has not been initialized, create the root organization context and its subcontents for the NIS+ root domain.


    # fncreate -t org org//
    
  3. Create the NIS+ map.


    # lpset -n fns -a bsdaddr=server1,printer1,extensions printer1
    
    -n fns

    Creates or updates the FNS content. 

    -a bsdaddr=server1,printer1,extensions
    

    Adds the print server, printer destination, and enables Solaris protocol extensions. 

    printer1

    Specifies the printer name. 

Example--Adding Domain-Wide Access to a Printer using NIS+

This example creates a printers.conf entry for the printer luna, connected to the print server, saturn.


 
# lpset -n fns -a bsaddr=saturn,luna,Solaris -a description=
"Room 1954 ps" luna

Enabling Print Clients to Access Existing Printers

Once you create a master /etc/printers.conf file that includes the existing printers at your site, you can enable all the SunSoft print clients to access the existing printers in two ways.

How to Use the /etc/printers.conf File to Load NIS

  1. Log in as superuser on the system that contains the /etc/printers.conf file to be copied to the NIS master server.

  2. Copy the system's /etc/printers.conf file to the NIS master server's /etc directory.

  3. Copy the /usr/lib/print/Makefile.yp makefile to the NIS master server's /var/yp directory.

  4. Log in as superuser on the NIS master server.

  5. On this system, specify how to process the files.


    # make -f /var/yp/makefile -f /var/yp/Makefile.yp printers.conf
    
    -f /var/yp/makefile

    Specifies the NIS makefile. 

    -f /usr/lib/print/Makefile.yp

    Specifies the NIS print makefile. This means implicit rules and predefined macros from both makefiles are concatenated. 

    printers.conf

    Specifies the file to be created or updated. 

How to Use the /etc/printers.conf File to Load NIS+

  1. Make sure you are a member of the NIS+ admin group. You must have the appropriate privileges to perform this task.

  2. Log in as superuser on the system that contains the /etc/printers.conf file to be copied to the NIS+ master file.

  3. Copy the system's /etc/printers.conf file to the NIS+ master file.


    # fncreate_printer -f /etc/printers.conf thisorgunit/service/printer
    

    See the Federated Naming Service Guide in the Solaris 2.6 Software Developer AnswerBook if you need information about entering this command.

Where to Go From Here

After you have given SunSoft print clients access to existing printers, users may want to set up the .printers file in their home directory to contain custom printer aliases. For step-by-step instructions, see the next section.

Setting Up a .printers File

There is no need to set up a .printers file in your users' home directories if they don't need customized printer information. However, the .printers file enables users to establish their own custom printer aliases. You can use the alias _default to make a printer the default and also set up a special alias _all to define a list of printers affected when you cancel a print request or check the status of printers.

Keep in mind that the LP commands check a user's home directory to locate printer configuration information before they check the name service. This means you can tailor a user's printer configuration file to use custom printer information rather than the shared information in the name service.

See printers(4) for detailed information about the .printers file.

(Optional) How to Set Up a .printers File

  1. Log in to the user's system as root.

  2. Start the file editor you want to use to create a .printers file in the user's home directory.

  3. (Optional) Set up the _default alias to make a specific printer your default printer, using an entry similar to the one shown in the following example.


    # _default printer_name
    
  4. (Optional) Set up the _all alias to define the printers affected when you cancel a print request or check the status of printers, using an entry similar to the one shown in the next example.


    # _all printer1 printer2 printer3
    
  5. Save the file as .printers.

Adding a Network Printer

A network printer is a hardware device that provides printing services to print clients without being directly cabled to a print server. It has its own system name and IP address, and is connected directly to the network. Even though a network printer is not connected to a print server, it is necessary to set up a print server for it. The print server provides queuing capabilities, filtering, and printing administration for the network printer.

Network printers use one or more special protocols that require a vendor-supplied printing program. The procedures to set up the vendor-supplied printing program can vary. If the printer does not come with vendor supplied support, the SunSoft network printer support may be used; it is strongly advised to use the print vendor supplied software when possible.

The vendor might supply an SVR4 printer interface script to replace the standard printer interface script. If so, their SVR4 interface script will call the vendor-supplied printing program to send the job to the printer. If not, you will need to modify the standard interface script to call the vendor-supplied printing program. You can do this by editing the per-printer copy of the standard interface script to call the vendor-supplied printing program.

The terms used in network printer configuration are:

Printer Vendor Supplied Software for Network Printers

Network printers often have software support provided by the printer vendor. If your printer has printer vendor supplied software it is strongly advised that the printer vendor software be utilized. The software is designed to support the attributes of the printer and can take full advantage of the printer capabilities. Read the printer vendor documentation to install and configure the printer under an LP print system.

Sun Support for Network Printers

If the network printer vendor does not provide software support, the Sun supplied software is available. The software provides generic support for network printers and is not capable of providing full access to all possible printer attributes.

A general discussion of how to add a network printer is provided in Chapter 41, Setting Up Printers (Tasks). The following is a discussion of printer management using the Sun supplied software.

Invoking the Network Printer Support

The software support for network printers is called through the interface script. Configuring a network printer with the network interface script, netstandard, causes the network printer support module to be called. The command to configure the printer with the network support is:

lpadmin -p printer_name -i /usr/lib/lp/model/netstandard 

Selecting the Protocol

The print sub-system uses BSD print protocol and raw TCP to communicate with the printer. The printer vendor documentation will provide the information about which protocol to use. In general, we have found that the TCP protocol is more generic across printers.

The command to select the protocol is:

lpadmin -p printer_name -o protocol=bsd

or

lpadmin -p printer_name -o protocol=tcp

If the protocol selected is the BSD print protocol, you may further select the order of sending the control file to the printer. Some printers expect the control file, then the data file; others the reverse. See the printer vendor documentation for this information. The default is to send the control file first.

The command to select the ordering is:

lpadmin -p printer_name -o bsdctrl=first

or

lpadmin -p printer_name -o bsdctrl=last

Selecting the Printer Node Name

The system administrator selects the printer node name. This name must be unique, as with any node on the network. The printer node name is connected with the IP address of the printer.

Selecting the Network Printer Access Name

The print subsystem requires access information for the printer. This is the name that the subsystem uses when making the network connection to the printer. This name is supplied by the system administrator to the print sub-system through the lpadmin command. It becomes part of the printer configuration database. The printer access name is the name of the printer node, sometimes qualified by a port name. Port designation varies across printer vendors. You will find information about port designation in the documentation that is provided with the printer by the printer vendor. The format of printer access name is:

printer_node-name[:port_designation]

Example 1--Network Printer Access Name with Port Designation (Number)

A common port designation with TCP is 9100. If the printer node name is pn1, and the printer vendor defines the port as 9100, then the printer access name is: pn1:9100. To configure a printer in this case use:

lpadmin -p printer_name -o dest=pn1:9100

Example 2--Network Printer Access Name with Port Designation (Name)

When using the BSD protocol, the port designation may not be a number, but some name defined by the printer vendor, for example: xxx_parallel_1. If the printer node name is cardboard, then the printer access name is: cardboard:xxx_parallel_1. To configure a printer in this case use:

lpadmin -p printer_name -o dest=cardboard:xxx_parallel_1

Example 3--Network Printer Access Name with No Port Designation

If there is no port designation, and the printer node name is newspaper, the printer access name is the printer node name: newspaper. To configure a printer in this case use:

lpadmin -p printer_name -o dest=newspaper

Setting the Timeout Value

The timeout option is provided to allow for individual selection of the amount of time (in seconds) to wait between successive attempts to connect to the printer. Some printers have a long warm up time and a longer timeout value is advised. The default is 10 seconds.

The timeout value does not impact the success or failure of the print process. It is a seed value which the software uses as the initial timeout count; on repeated failures, this count is increased. A message is sent to the spooler when repeated attempts to connect to the printer fail. This alerts the user that intervention may be required. This could be anything from the printer being turned off, to out of paper. Should these messages be produced too often, for example when the printer is warming up, increasing the timeout value will eliminate spurious messages.

The system administrator can experiment to find the optimal timeout value. The command to set the timeout is:

lpadmin -p printer_name -o timeout=n

Managing Network Printer Access

Each network printer should have one and only one server that provides access to it. This enables the server to manage the access to the printer and keep jobs coherent.

The default device for the network printer is /dev/null. This is sufficient when there is only one queue for the printer. Should more queues be required, set the device to a file. This enables the print system to restrict access to the printer across queues. The following commands create a device file and configure it as the network printer device.


touch /path/filename
chmod 600 /path/filename
lpadmin -p printer_name -v /path/filename

The following is an example of creating a device file called devtreedown.


# touch /var/tmp/devtreedown
# chmod 600 /var/tmp/devtreedown
# lpadmin -p treedown -v /var/tmp/devtreedown

How to Add a Network Printer Using Printer Vendor Supplied Tools

  1. Connect the printer to the network and turn on the power to the printer.

    Consult the printer vendor's installation documentation for information about the hardware switches and cabling requirements. Get an IP address and select a name for the printer node. This is equivalent to adding any node to the network.

  2. Follow the printer vendor instructions to add the network printer to a SunOS 5.x system that has an SVR4 LP print spooler.

    Use the printer vendor instructions to configure the network printer. These will be specific to the vendor and printer.

  3. Add client access to the new printer.

    Now that the printer has been added, create access to the printer for the clients. See "Setting Up a Print Client".

  4. Optional tasks to complete.

    There are several optional tasks you may want to complete when setting up a network printer. See "Setting Up Printing Task Map" for pointers to the remaining tasks.

How To Add A Network Printer Using LP Commands


Note -

This describes the steps necessary to setup a network printer using the SunSoft Network Printer support software. The use of this software is intended for those printers that do not come with vendor supplied software.


  1. Connect the printer to the network and turn on the power to the printer.

    Consult the printer vendor's installation documentation for information about the hardware switches and cabling requirements. Get an IP address and select a name for the printer node. This is equivalent to adding any node to the network.

  2. Collect the information required to configure a network printer.

    • Printer name

    • Printer server

    • Network printer access name

    • Protocol

    • Timeout

    See the terms described in "Adding a Network Printer" for more information.

  3. Define the printer name, the device, the printer type and content type by using the lpadmin command.

    1. Define the printer name and the port device the printer will use.


      # lpadmin -p printer-name -v /dev/null
      

      The device to use is /dev/null.

    2. Identify the interface script the printer will use.


      # lpadmin -p printer-name -i /usr/lib/lp/model/netstandard 
      

      The interface script that is supplied with the SunSoft network printer support software is /usr/lib/lp/model/netstandard.

    3. Set the printer destination, protocol, and timeout values.


      # lpadmin -p printer-name -o dest=access-name:port -o protocol=protocol
      -o timeout=value
      
      -p printer-name
      

      Specifies the network printer name. 

      -o dest=access-name:port
      

      Sets the printer destination to the network printer access name and a designated printer vendor port, if it is defined in the printer vendor documentation. See "Adding a Network Printer" for more information.

      -o protocol:protocol
      

      Sets the over-the-wire protocol used to communicate with the printer. Both BSD and raw TCP are supported. 

      -o timeout:value
      

      Sets a retry timeout value that represents a number of seconds to wait between attempting connections to the printer. See "Adding a Network Printer" for more information.

    4. Specify the file content types of the printer and the printer type.


      # lpadmin -p printer-name -I content-type -T printer-type
      
  4. Add filters to the print server by using the lpfilter command.


    #	cd /etc/lp/fd
    # for filter in *.fd;do
        > name=`basename $filter .fd`
        > lpfilter -f $name -F $filter
        > done
    
  5. Enable the printer to accept printer requests and to print the requests.


    # accept printer-name
    #	enable printer-name
    
  6. Verify the printer is correctly configured by using the lpstat command.


    #	lpstat -p printer-name
    
  7. Add client access to the new printer.

    Now that the printer has been added, create access to the printer for the clients. See "Setting Up a Print Client".

  8. Optional tasks to complete.

    There are several optional tasks you may want to complete when setting up a printer. See "Setting Up Printing Task Map" for pointers to the remaining tasks.

Example--Adding a Network Printer Using LP Commands

The commands in this example must be executed on the print server. The following information is used in the example and may change depending on your situation:

Chapter 42 Administering Printers (Tasks)

This chapter provides the procedures to administer printers. This is a list of the step-by-step instructions in this chapter.

For overview information about printing and the LP print service, see Chapter 39, Print Management (Overview).

Managing Printers and the Print Scheduler

This section provides instructions for day-to-day tasks you perform to manage printers and the print scheduler.

Deleting Printers and Printer Access

If a printer needs to be replaced or you want to move the printer to a different location, you must delete the printer information from the LP print service before you physically remove it from the print server. You should also make sure that all the current print requests on the printer are printed or moved to another printer to be printed.

Not only does the printer information need to be deleted from the print server, but it also needs to be deleted from the print clients or network name service. If you delete a local printer from a print server, you should delete the remote printer entry from the print clients or network name service. If you move a printer to another print server, you need to delete the old remote print entry from the print clients or network name service and add access to the remote printer in its new location.

See "How to Delete a Printer and Remote Printer Access" for detailed information on how to delete a local and remote printer. You can use Admintool to delete a local or remote printer; however, Admintool does not enable you to move queued print requests to another printer.

How to Delete a Printer and Remote Printer Access

  1. Log in as superuser or lp on a print client that has access to the printer you want to delete.

  2. Delete information about the printer from the print client.


    print-client# lpadmin -x printer-name
    
    -x

    Deletes the specified printer. 

    printer-name

    Name of the printer you want to delete. 

    Information for the specified printer is deleted from the print client's /etc/lp/printers directory.

  3. If the print client does not use another printer on the same print server, delete information about the print server from the print client.


    print-client# lpsystem -r print-server
    
    -r

    Removes the specified print server. 

    print-server

    Name of the print server you want to delete. 

    The print server is deleted from the print client's /etc/lp/Systems file.

  4. Repeat Step 2through Step 3 on each print client that has access to the printer.

  5. Log in as superuser or lp on the print server.

  6. Stop accepting print requests on the printer.


    print-server# reject printer-name
    
    reject printer-name
    

    Rejects print requests for the specified printer. 

    This step prevents any new requests from entering the printer's queue while you are in the process of removing the printer. See "How to Accept or Reject Print Requests for a Printer" for a detailed description.

  7. Stop the printer.


    print-server# disable printer-name
    

    This step stops print requests from printing. See "How to Enable or Disable a Printer" for a detailed description on how to stop printing.

  8. Move any print requests that are still in the queue to another printer.

    See "How to Move Print Requests to Another Printer" for a detailed description on how to move print requests to another printer.

  9. Delete the printer from the print server.


    print-server# lpadmin -x printer-name
    

    Configuration information for the printer is deleted from the print server's /etc/lp/printers directory.

  10. Delete information about the print clients that were using the printer you just deleted, unless they are still using another printer on the print server.


    print-server# lpsystem -r print-client1 [,print-client2...]
    
    -r

    Removes the specified print client. 

    print-client

    Name of the print client you want to delete from the print server. You can specify multiple print clients in this command. Use a space or a comma to separate print client names. If you use spaces, enclose the list of print clients in quotes. 

    The specified print clients are deleted from the print server's /etc/lp/Systems file.

  11. Verify the printer information has been deleted.

    1. Check the printer information has been deleted on the print client.


      print-client$ lpstat -p printer-name -l
      

      You should receive an error indicating that the printer does not exist in the output of the above command.

    2. Check the printer information has been deleted on the print server.


      print-server$ lpstat -p printer-name -l
      

      You should receive an error indicating that the printer does not exist in the output of the above command.

Example--Deleting a Printer and Remote Printer Access

In the following example, the commands delete the printer luna from the print client terra and from the print server jupiter, and also delete the print client terra from the print server.


terra# lpadmin -x luna
Removed "luna".
terra# lpstat -p luna -l 
jupiter# lpadmin -x luna
jupiter# lpsystem -r terra
Removed "terra".
jupiter# lpstat -p luna -l 

Checking Printer Status

Many routine printer administration tasks require information about the status of the LP print service or a specific printer. For example, you may need to determine which printers are available for use and examine the characteristics of those printers. You can use the lpstat command to find out status information about the LP print service or a specific printer.

How to Check the Status of Printers

  1. Log in on any system on the network.

  2. Check the status of printers by using the lpstat command.

    Only the most commonly used options are shown here. See the lpstat(1) man page for other options.


    $ lpstat [-d] [-p printer-name [-D] [-l]] [-t]
    -d
    

    Shows the system's default printer. 

    -p printer-name
    

    Shows if a printer is active or idle, when it was enabled or disabled, and whether it is accepting print requests. 

    You can specify multiple printer names with this command. Use a space or a comma to separate printer names. If you use spaces, enclose the list of printer names in quotes. If you don't specify printer-name, the status of all printers is displayed.

    -D
    

    Shows the description of the specified printer-name.

    -l
    

    Shows the characteristics of the specified printer-name.

    -t
    

    Shows status information about the LP print service, including the status of all printers: whether they are active and whether they are accepting print requests. 

Examples--Checking the Status of Printers

In the following example, the command requests the name of the system's default printer.


$ lpstat -d
system default destination: luna

In the following example, the command requests the status of the printer luna.


$ lpstat -p luna
printer luna is idle. enabled since Feb 18 16:06 1997. available.

In the following example, the command requests a description of the printers asteroid and luna.


$ lpstat -p "asteroid luna" -D
printer asteroid faulted. enabled since Feb 18 16:07 1997. available.
	unable to print: paper misfeed jam
 
	Description: Printer by break room.
printer luna is idle. enabled since Feb 18 16:07 1997. available.
	Description: Printer by server room.

In the following example, the command requests the characteristics of the printer luna.


$ lpstat -p luna -l
printer luna is idle. enabled since Thu May  2 09:20:17 MDT 1996. 
available.
	Content types: any
	Printer types: unknown
	Description: Printer by server room.
	Users allowed:
		(all)
	Forms allowed:
		(none)
	Banner not required
	Character sets:
		(none)
	Default pitch:
	Default page size:

Restarting the Print Scheduler

The print scheduler, lpsched, handles print requests on print servers. However, there may be times when the print scheduler stops running on a system, so print requests stop being accepted or printed.

To restart the print scheduler, you can use the /usr/lib/lp/lpsched command. If a print request was printing when the print scheduler stopped running, the print request will be printed in its entirety when you restart the print scheduler.

How to Stop the Print Scheduler

  1. Log in as superuser or lp on the print server.

  2. Check to see if the print scheduler is running.


    # lpstat -r
    

    If the print scheduler is not running, the message scheduler is not running is displayed.

  3. If the print scheduler is running, stop it.


    # /usr/lib/lp/lpshut
    

How to Restart the Print Scheduler

  1. Log in as superuser or lp on the print server.

  2. Check to see if the print scheduler is running.


    # lpstat -r
    

    If the print scheduler is not running, the message scheduler is not running is displayed.

  3. If the print scheduler is not running, start it.


    # /usr/lib/lp/lpsched
    

Setting or Resetting Miscellaneous Printer Definitions

This section provides step-by-step instructions on setting or resetting printer definitions. Some of the following printer definitions can be set using Admintool or Solstice Printer Manager. The procedures below use the lp commands to quickly set or reset printer definitions.

How to Add a Printer Description

  1. Log in as superuser or lp on the print server.

  2. Add a printer description by using the lpadmin command.


    # lpadmin -p printer-name -D "comment"
    p printer-name
    

    Name of the printer for which you are adding a description. 

    -D "comment"
    

    Specifies the characteristics of the printer, such as location or administrative contact. Enclose characters that the shell might interpret (like *, ?, \, !, ^) in single quotation marks.

    The printer description is added in the print server's /etc/lp/printers/printer-name/comment file.

  3. Verify the Description information is correct.


    $ lpstat -p printer-name -l
    

Example--Adding a Printer Description

In the following example, the command adds a printer description for the printer luna.


# lpadmin -p luna -D "Nathans office"

Setting Up a Default Printer Destination

You can specify a default printer destination for a system so you don't need to type the printer name when using the print commands. Before you can designate a printer as the default, the printer must be known to the print service on the system. You can set a system's default printer destination by setting any of the following:

When an application provides a printer destination, that destination is used by the print service, regardless of whether you have set a system's default printer destination. If an application doesn't provide a printer destination or if you don't provide a printer name when using a print command, the print command searches for the default printer in a specific order. Table 42-1 shows the search order for a system's default printer destination.

Table 42-1 Search Order for Default Printer Destinations

Search Order 

Using /usr/bin/lp Command

Using lpr, lpq, and lprm Commands

First 

LPDEST variable

PRINTER variable

Second 

PRINTER variable

LPDEST variable

Third 

System's default printer 

System's default printer 

How to Set a System's Default Printer

  1. Log in as superuser or lp on the system for which you want to set a default printer.

  2. Set the system's default printer by using the lpadmin command.


    # lpadmin -d [printer-name]
    -d printer-name
    

    Name of the printer you are assigning as the system's default printer. If you don't specify printer-name, the system is set up with no default printer.

    The default printer name is entered in the system's /etc/lp/default file.

  3. Check the system's default printer by using the lpstat command.


    $ lpstat -d
    

Example--Setting a System's Default Printer

In the following example, the command sets the printer luna as the system's default printer. This means that luna will be used as the system's default printer if the LPDEST or PRINTER environment variables are not set.


# lpadmin -d luna
# lpstat -d
system default destination: luna

Printing Banner Pages

A banner page identifies who submitted the print request, the print request ID, and when the request was printed. A banner page will also have a modifiable title to help users identify their printouts.

Banner pages make identifying the owner of a print job easy, which is especially helpful when many users submit jobs to the same printer. Printing banner pages uses more paper, however, and may not be necessary if a printer has only a few users. In some cases, printing banner pages is undesirable. For example, if a printer has special paper or forms mounted, like paycheck forms, printing banner pages may cause problems.

By default, the print service forces banner pages to be printed. However, you can give users a choice to turn off printing of a banner page when they submit a print request. You can set this choice through the lpadmin command or through Admintool. If you give the users a choice, they have to use the -o nobanner option to turn off printing of a banner page.

Also, you can turn off banner pages for a printer so they are never printed. This is important if you have a situation where you don't need or want banner pages. You can turn off banner page printing through the command line interface only. For step-by-step command-line instructions, see "How to Turn Off Banner Pages".

How to Make Banner Pages Optional

  1. Log in as superuser or lp on the print server.

  2. Make banner pages optional by using the lpadmin command.


    # lpadmin -p printer-name -o nobanner
    
    -p printer-name
    

    Name of the printer for which you are making banner pages optional. 

    -o nobanner 
    

    Enables users to specify no banner page when they submit a print request. 

    If you want to force a banner page to print with every print request, specify the -o banner option.

    The banner page setting is entered in the print server's /etc/lp/printers/printer-name/configuration file.

  3. Verify the output from the following command contains the line Banner not required.


    $ lpstat -p printer-name -l
    

Example--Making Banner Pages Optional

In the following example, the command enables users to request no banner page on the printer luna.


# lpadmin -p luna -o nobanner

How to Turn Off Banner Pages

  1. Log in as superuser or lp on the print server.

  2. Change directory to the /etc/lp/interfaces directory.


    # cd /etc/lp/interfaces
    
  3. Edit the file that has the name of the printer for which you want to turn off banner pages.

  4. Change the nobanner variable to yes.


    nobanner="yes"

    Change the nobanner variable to no if you want to turn banner pages on again.

    The banner page setting is entered in the print server's /etc/lp/printers/printer-name/configuration file.

  5. Submit a print request to the printer to make sure a banner page does not print.

Setting Up Printer Classes

The print service enables you to group several locally attached printers into one class. You can perform this task only by using the lpadmin -c command.

When you have set up a printer class, users can then specify the class (rather than individual printers) as the destination for a print request. The first printer in the class that is free to print is used. The result is faster turnaround because printers are kept as busy as possible.

There are no default printer classes known to the print service; printer classes exist only if you define them. Here are some ways you could define printer classes:

Alternatively, a class might contain several printers that are used in a particular order. The LP print service always checks for an available printer in the order in which printers were added to a class. Therefore, if you want a high-speed printer to be accessed first, you would add it to the class before you add a low-speed printer. As a result, the high-speed printer would handle as many print requests as possible. The low-speed printer would be reserved as a backup printer when the high-speed printer is in use.


Note -

Print requests are balanced between printers in a class only for local printers.


Class names, like printer names, must be unique and may contain a maximum of 14 alphanumeric characters and underscores.

You are not obligated to define printer classes. You should add them only if you determine that using printer classes would benefit users on the network.

How to Define a Class of Printers

  1. Log in as superuser or lp on the print server.

  2. Define a class of printers by using the lpadmin command.


    # lpadmin -p printer-name -c printer-class
    
    -p printer-name
    

    Name of the printer you are adding to a class of printers. 

    -c printer-class
    

    Name of a class of printers. 

    The specified printer is added to the end of the list in the class in the print server's /etc/lp/classes/printer-class file. If the printer class does not exist, it is created.

  3. Verify the printers in a printer class by using the lpstat command.


    $ lpstat -c printer-class
    

Example--Defining a Class of Printers

In the following example, the command adds the printer luna in the class roughdrafts.


# lpadmin -p luna -c roughdrafts

Setting Up Printer Fault Alerts

If you choose, the print service can notify you when it detects a printer fault. You can select any of the following methods to receive printer fault notification with the lpadmin -A command or with Admintool:

However, the lpadmin -A command offers you an additional option of receiving a message specified by the program of your choice. It also enables you to selectively turn off notification for an error that you already know about.

Unless you specify a program to deliver fault notification, the content of the fault alert is a predefined message that says the printer has stopped printing and needs to be fixed.

Table 42-2 lists the alert values that you can set for a printer with the lpadmin -A command. These alert values can also be set for print wheels, font cartridges, and forms.

Table 42-2 Values for Printing Problem Alerts

Value for -A alert

Description 

'mail [user-name]'

Send the alert message by email to root or lp on the print server, or the specified user-name, which is a name of a user.

'write [user-name]'

Send the alert message to the root or lp console window on the print server, or to the console window of the specified user-name, which is a name of a user. The specified user must be logged in to the print server to get the alert message.

'command'

Run the command file for each alert. The environment variables and current directory are saved and restored when the file is executed.

quiet

Stop alerts until the fault is fixed. Use this when you (root or specified user) receive repeated alerts. 

none

Do not send any alerts. This is the default if you don't specify fault alerts for a printer. 

How to Set Fault Alerts for a Printer

  1. Log in as superuser or lp on the print server.

  2. Set fault alerts for a printer with the lpadmin command.


    # lpadmin -p printer-name -A alert [-W minutes]
    -p printer-name
    

    Name of the printer for which you are specifying an alert for printer faults. 

    -A alert
    

    Specifies what kind of alert will occur when the printer faults. See Table 42-2 for detailed information about the valid values for alert. Some valid values are mail, write, and quiet.

    -W minutes
    

    Specifies how often (in minutes) the fault alert will occur. If you don't specify this option, the alert is sent once. 

    The fault alert setting is entered in the print server's /etc/lp/printers/printer-name/alert.sh file.

  3. Check the information following the On fault heading from the output of the following command.


    $ lpstat -p printer-name -l
    

Examples--Setting Fault Alerts for a Printer

In the following example, the command sets up the printer mars to send fault alerts by email to a user named joe, with reminders every 5 minutes.


# lpadmin -p mars -A 'mail joe' -W 5

In the following example, the command sets up the printer venus to send fault alerts to the console window, with reminders every 10 minutes.


# lpadmin -p venus -A write -W 10

In the following example, the command stops fault alerts for the printer mercury.


# lpadmin -p mercury -A none

In the following example, the command stops fault alerts until the printer venus has been fixed.


# lpadmin -p venus -A quiet

Setting Up Printer Fault Recovery

If you choose not to send any fault notification, you may want a way to find out about printing faults so you can correct the problem. The LP print service will not continue to use a printer that has a fault. In addition to alerts for printer faults, you can also provide alerts that tell the system administrator to mount print wheels, font cartridges, and forms when print requests require them.

You can define the fault recovery options for a printer only by using the lpadmin -F command. This task is not available in Admintool.

Printer faults can be as simple as running out of paper or needing to replace a toner cartridge. Other more serious problems may include complete printer failure or power failure. After you fix a printer fault, the print request that was active when the fault occurred begins printing in one of three ways:

A print filter is required to continue printing from the top of a page where the printing stopped. A print filter records the control sequences used by the printer to track page boundaries, which the default filters used by the print service cannot do. You will be notified by the print service if recovery cannot proceed with the specified print filter. For information about writing filters, see "How to Create a New Print Filter".

If you want printing to resume immediately after a printer fault is fixed, enable the printer by using the enable command.

Table 42-3 lists the fault recovery values you can set for a printer with the lpadmin -F command.

Table 42-3 Values for Printer Fault Recovery

Value for -F recover-options

Description 

beginning

After a fault recovery, printing restarts from the beginning of the file. 

continue

After a fault recovery, printing starts at the top of the page where the printing stopped. This recovery option requires a print filter.

wait

After a fault recovery, printing stops until you enable the printer. After you enable the printer (enable command), printing starts at the top of the page where printing stopped. This recovery option requires a print filter.

How to Set Printer Fault Recovery

  1. Log in as superuser or lp on the print server.

  2. Set up fault recovery for the printer with the lpadmin command.


    # lpadmin -p printer-name -F recovery-options
    
    -p printer-name
    

    Name of the printer for which you are specifying fault recovery. 

    -F recovery-options
    

    One of the three valid recovery options: 

    -beginning, -continue, or -wait.

    See Table 42-3 for detailed information about the valid values for recovery-options.

    The fault recovery setting is entered in the print server's /etc/lp/printers/printer-name/configuration file.

  3. Check the information following the After fault heading in the output of the following command.


    $ lpstat -p printer-name -l
    

Example--Setting Printer Fault Recovery

In the following example, the command sets up the printer luna to continue printing at the top of the page where printing stopped.


# lpadmin -p luna -F continue

Limiting User Access to a Printer

You may want to control which users can access some or all of the available printers. For example, you may want to prevent some users from printing on a high-quality printer to minimize expense. To restrict user access to printers, you can create allow and deny lists using the lpadmin -u command on the print server. (Admintool enables you to create only allow lists.) If you create neither, a printer is available to all users who can access the printer.

An allow list contains the names of users allowed access to the specified printer; a deny list contains the names of users denied access to the specified printer.

The rules for allow and deny lists are:

When You ... 

Then ... 

Do not create allow and deny lists, or if you leave both lists empty 

All users may access the printer. 

Specify all in the allow list

All users may access the printer. 

Specify all in the deny list

All users, except root and lp (on the server), are denied access to the printer.

Make any entry in the allow list 

The deny list is ignored. Only those users who are listed can access the printer. 

Create a deny list, but you do not create an allow list or you leave the allow list empty 

Users who are listed in the deny list are denied access to the printer. 

Because the print server is actually controlling access to the printer, allow and deny lists can only be created on the print server itself. If you create allow and deny lists, the print server will exclusively control user access to printers.

Table 42-4 lists the values you can add to an allow or deny list to limit user access to a printer.

Table 42-4 Values for Allow and Deny Lists

Value for user-list

Description 

user

User on any system

all

All users on all systems 

none

No user on any system 

system!user

User on system only

!user

User on local system only

all!user

User on any system

all!all

All users on all systems 

system!all

All users on system

!all

All users on local system 

How to Limit User Access to a Printer

  1. Log in as superuser or lp on the print server.

  2. Allow or deny users access to a printer by using the lpadmin command.


    # lpadmin -p printer-name -u allow:user-list [ deny:user-list]
    -p printer-name
    

    Name of the printer to which the allow or deny user access list applies. 

    -u allow:user-list
    

    User names to be added to the allow user access list. You can specify multiple user names with this command. Use a space or a comma to separate names. If you use spaces, enclose the list of names in quotes. 

    Table 42-4 provides the valid values for user-list.

    -u deny:user-list
    

    User names to be added to the deny user access list. You can specify multiple user names with this command. Use a space or a comma to separate names. If you use spaces, enclose the list of names in quotes. 

    Table 42-4 provides the valid values for user-list.

    The specified users are added to the allow or deny user access list for the printer in one of the following files on the print server:

    /etc/lp/printers/printer-name/users.allow

    /etc/lp/printers/printer-name/users.deny


    Note -

    If you specify none as the value for user-list in the allow user access list, the following files are not created for the print server:

    /etc/lp/printers/printer-name/alert.sh

    /etc/lp/printers/printer-name/alert.var

    /etc/lp/printers/printer-name/users.allow

    /etc/lp/printers/printer-name/users.deny


  3. Check the information following the Users allowed or Users denied heading in the output of the following command.


    $ lpstat -p printer-name -l
    

Examples--Limiting User Access to a Printer

In the following example, the command allows only the users nathan and george access to the printer luna.


# lpadmin -p luna -u allow:nathan,george

In the next example, the command denies the users nathan and george access to the printer asteroid.


# lpadmin -p asteroid -u deny:"nathan george"

Managing Print Requests

When a user submits a print request from a print client, the print request is added to a queue on the print server before it is sent to the printer. While a print request is in the queue, you can cancel or gain status information on the request from a client system. To move, hold, resume, or change the priorities of print requests you must login to the print server. These actions can help you keep printing services operating smoothly.

The LP commands enable you to perform all print request management tasks. Admintool enables you to perform some print request management tasks when you modify a print server. Table 42-5 lists the print request management tasks you can perform with Admintool.

Table 42-5 Print Request Management With Admintool

Task 

Can You Do With Admintool? 

Canceling a print request 

No 

Moving a print request 

No 

Changing priority of print requests 

No 

Accepting or rejecting print requests 

Yes 

Processing or stopping printing 

Yes 

Table 42-6 lists the values for changing the priority of a print request with the lp -H command.

Table 42-6 Values for Changing the Priority of a Print Request

Value for -H change-priority

Description 

-hold

Places the print request on hold until you cancel it or instruct the LP print service to resume printing the request. 

-resume

Places a print request that has been on hold back in the queue. It will be printed according to its priority and placement in the queue. If you put a hold on a print job that is already printing, resume puts the print request at the head of the queue so it becomes the next request printed.

-immediate

Places a print request at the head of the queue. If a request is already printing, you can put it on hold to allow the next request to print immediately. 

How to Check the Status of Print Requests

  1. Log in on any system on the network.

  2. Check the status of printers and print requests by using the lpstat command.

    Only the most commonly used options are shown here. See the lpstat(1) man page for other valid options.


    $ lpstat -o [list] | -u [user-list]
    -o list
    

    Shows the status of print requests on a specific printer. list can be one or more printer names, printer class names, or print request IDs.

    You can specify multiple printer names, class names, and IDs for list. Use a space or a comma to separate values. If you use spaces, enclose the list of values in quotes.

    If you don't specify list, the status of print requests to all printers is displayed.

    -u user-list
    

    Shows the status of print requests for a specific user. user-list can be one or more user names.

    You can specify multiple users with this command. Use a space or a comma to separate user names. If you use spaces, enclose the list of names in quotes. 

    If you don't specify user-list, the status of print requests for all users is displayed.

    When used to check the status of print requests, the lpstat command displays one line for each print request. From left to right, the line shows the request ID, the user, the output size in bytes, the date and time of the request, and information about the request, such as "being filtered."

Examples--Checking the Status of Print Requests

In the following example, the command shows that user fred has one print request queued to the printer luna.


$ lpstat
luna-1    fred     1261    Mar 12 17:34

In the following example, the command shows that the user paul currently has no print requests in queue.


$ lpstat -u paul

In the following example, the command shows that there are two print requests on the printer moon.


$ lpstat -o moon
moon-78    root     1024   Jan 14 09:07
moon-79    root     1024   Jan 14 09:08

Processing or Stopping Printing

The enable and disable commands (or the Process Print Requests field on Admintool's Modify Printer window) control whether a printer prints or stops printing requests that are in the print queue. When you disable a printer, the printer stops printing requests in queue; however, requests are still added to the queue. (You must set the printer to reject print requests so requests are not added to the queue. See "Accepting or Rejecting Print Requests" for information about rejecting print requests.)

You must enable the printer whenever it has been disabled, which may happen when a printer fault occurs. When you enable a printer, it prints requests from the print queue until the queue is empty, even if the print service rejects additional requests for the print queue.

Figure 42-1 shows the point at which processing of print requests is interrupted when a printer is disabled.

Figure 42-1 What Happens When a Printer Is Enabled or Disabled

Graphic

How to Accept or Reject Print Requests for a Printer

  1. Log in as superuser or lp on the print server.

  2. Stop accepting print requests for the printer by using the reject command.


    # reject [-r "reason"] printer-name
    
    -r "reason"
    

    Provides users a reason why the printer is rejecting print requests. The reason is stored and displayed whenever a user checks on the status of the printer (lpstat -p).

    printer-name

    Name of the printer that will stop accepting print requests. 

    The queued requests will continue printing as long as the printer is enabled. For instructions on disabling a printer so it stops printing, see "How to Enable or Disable a Printer".

  3. Start accepting print requests for the printer by using the accept command.


    # accept printer-name
    
  4. Check the status of the printer to see whether it is accepting or rejecting print requests by using the lpstat command.


    $ lpstat -p printer-name
    

Examples--Accepting or Rejecting Print Requests for a Printer

In the following example, the command stops the printer luna from accepting print requests.


# reject -r "luna is down for repairs" luna
destination "luna" will no longer accept requests

In the following example, the command sets the printer luna to accept print requests.


# accept luna
destination "luna" now accepting requests

Accepting or Rejecting Print Requests

The accept and reject commands--or the Accept Print Requests field in Admintool's Modify Printer window--enable you to turn on or turn off a print queue that stores requests to be printed.

When you use the reject command, the print queue for a specified printer is turned off--no new print requests can enter the queue on the print server. All print requests that are in the queue are still printed. You must disable the printer if you want it to stop printing requests that are already in the queue. Table 42-7 compares the functions of the accept, reject, enable, and disable commands.

Table 42-7 Functions of accept/reject and enable/disable Commands

Command 

Function 

accept

Accept print requests that are sent to the print queue. 

enable

Print the requests that are in the print queue. 

reject

Reject print requests that are sent to the print queue. 

disable

Stop printing requests that are currently in the print queue. 

See "Processing or Stopping Printing" for information about disabling a printer.

If a print request is rejected, the print service writes or mails a message to the user who submitted the request, saying that print requests are not being accepted for the specified printer.

You can also specify a reason for not accepting requests through the command line. The reason is displayed on users' systems when one tries to check the printer's queue. Figure 42-2 shows the point at which processing of print requests is interrupted when a print queue rejects print requests.

Figure 42-2 What Happens When a Print Queue Accepts or Rejects Requests

Graphic

How to Enable or Disable a Printer

  1. Log in as superuser or lp on the print server.

  2. Stop printing print requests on the printer by using the disable command.


    # disable [-c | -W] [-r "reason"] printer-name
    
    disable

    Cancels the current job, then disables the printer. The current job is saved to reprint when the printer is enabled.

    -c
    

    Cancels the current job, then disables the printer. The current job is not printed later. 

    -W
    

    Waits until the current job is finished before disabling the printer. 

    -r "reason"
    

    Provides users with a reason why the printer is disabled. The reason is stored and displayed whenever a user checks on the status of the printer (lpstat -p).

    printer-name

    Name of the printer that will stop printing print requests. 


    Note -

    You cannot enable or disable classes of printers. Only individual printers can be enabled or disabled.


  3. Start printing print requests on the printer by using the enable command.


    # enable printer-name
    
  4. Verify the printer is enabled.


    $ lpstat -p printer-name
    

Examples--Enabling or Disabling a Printer

In the following example, the command stops the current job on the printer luna, saves it to print later, and provides a reason why the printer has stopped printing print requests.


# disable -r "changing the form" luna

In the following example, the command starts printing print requests on the printer luna.


# enable luna
printer "luna" enabled

Canceling a Print Request

You can use the cancel command to cancel print requests from printer queues or to cancel jobs that are printing. There are three ways to use the cancel command:

When you use cancel, a message tells you the request(s) are canceled, and the next request in queue is printed. You can cancel a print request only if you are:

To cancel a specific request, you need to know its request ID. The request ID is comprised of the name of the printer, a dash, and the number of the print request--for example, luna-185. When you submit the print request, the request ID is displayed. If you do not remember the print request ID, you can find it by using the lpstat command with the -o printer option.

How to Cancel a Print Request

  1. If you are going to cancel print requests of other users, become superuser or lp.

  2. Determine the request IDs of the print requests to cancel by using the lpstat command.

    See "How to Check the Status of Print Requests" for more details.

  3. Cancel a print request by using the cancel command.


    $ cancel request-id | printer-name
    

    request-id

    Request ID of a print request to be canceled. You can specify multiple request IDs with this command. Use a space or a comma to separate request IDs. If you use spaces, enclose the list of request IDs in quotes.

    printer-name

    Specifies the printer for which you want to cancel the currently printing print request. 

    You can specify multiple printer names with this command. Use a space or a comma to separate printer names. If you use spaces, enclose the list of printer names in quotes. 

  4. Verify the print requests are canceled.


    $ lpstat -o printer-name
    

Examples--Canceling a Print Request

In the following example, the command cancels the luna-3 and luna-4 print requests.


$ cancel luna-3 luna-4
request "luna-3" cancelled
request "luna-4" cancelled

In the following example, the command cancels the print request that is currently printing on the printer luna.


# cancel luna
request "luna-9" cancelled

How to Cancel a Print Request From a Specific User

  1. (Optional) Become superuser or lp if you are going to cancel print requests of other users.

  2. Cancel a print request from a specific user with the cancel command.


    $ cancel -u user-list [printer-name]
    -u user-list
    

    Cancels the print request for a specified user.  

    user-list can be one or more user names. Use a space or a comma to separate user names. If you use spaces, enclose the list of names in quotes.

    printer-name

    Specifies the printer for which you want to cancel the specified user's print requests. 

    printer-name can be one or more printer names. Use a space or a comma to separate printer names. If you use spaces, enclose the list of printer names in quotes.

    If you don't specify printer-name, the user's print requests will be canceled on all printers.

Examples--Canceling a Print Request From a Specific User

In the following example, the command cancels all the print requests submitted by the user george on the printer luna.


# cancel -u george luna
request "luna-23" cancelled

In the following example, the command cancels all the print requests submitted by the user george on all printers.


# cancel -u george
request "asteroid-3" cancelled
request "luna-8" cancelled

Moving a Print Request

If you plan to change the way a printer is used or decide to take a printer out of service, you should set up the LP print service to reject additional print requests, and then move or cancel any requests that are currently queued to the printer. You can use the lpmove command to move individual or all print requests to another local printer.

Request IDs are not changed when you move print requests, so users can still find their requests. Print requests that have requirements (such as file content type or forms) that cannot be met by the newly specified printer cannot be moved; they must be canceled.

How to Move Print Requests to Another Printer

To move all print requests from one printer to another, you do not need to know the request IDs; however, it is a good idea to see how many print requests are affected before you move them.

  1. Log in as superuser or lp on the print server.

  2. (Optional) Check the request IDs of the print requests on the original printer.


    # lpstat -o printer-name1
    
  3. (Optional) Check if the destination printer is accepting print requests.


    # lpstat -p printer-name2
    
    -p printer-name2
    

    Name of the printer to which you are moving the print requests. 

  4. Move all the print requests from the original printer to the destination printer.


    # lpmove printer-name1 printer-name2
    

    printer-name1

    Name of the printer from which all print requests will be moved.  

    printer-name2

    Name of the printer to which all print requests will be moved. 

    If some requests cannot be printed on the destination printer, they are left in the original printer's queue. By using request IDs, you can also move specific print requests to another printer with the lpmove command.

  5. Start accepting print requests on the original printer.

    If you move all the print requests to another printer, the lpmove command automatically stops accepting print requests for the printer. This step is necessary if you want to begin accepting new print requests for the printer.


    # accept printer-name1
    
  6. Check for any remaining print requests in the original printer's queue by using the following command.


    $ lpq -P printer-name1
    

    Make sure all specified print requests were moved to the destination printer's queue by using the following command.


    $ lpq -P printer-name2
    

Example--Moving Print Requests to Another Printer

In the following example, the lpmove command moves print requests from the printer luna to the printer terra, and the accept command tells the original printer luna to resume accepting print requests.


# lpmove luna terra
# accept luna

Changing the Priority of Print Requests

After a user has submitted a print request, you can change its priority in the print server's queue by:

How to Change the Priority of a Print Request

  1. Log in as superuser or lp on the print server that is holding the print request.

  2. Determine the request IDs of the print requests whose priority you want to change by using the lpstat command.

    See "How to Check the Status of Print Requests" for more information.

  3. Change the priority of a print request by using the lp command.


    # lp -i request-id -H change-priority
    
    -i request-id
    

    Request ID of a print request you want to change.

    You can specify multiple request IDs with this command. Use a space or a comma to separate request IDs. If you use spaces, enclose the list of request IDs in quotes. 

    -H change-priority
    

    One of the three ways to change the priority of a print request: -hold, -resume, -immediate.

    See Table 42-6 for detailed information about valid values for change-priority.

    You can also use the -q option of the lp command to change the priority level of a specified print request. You can change the priority level from 0, the highest priority, to 39, the lowest priority.

Example--Changing the Priority of a Print Request

In the following example, the command changes a print request with the request ID asteroid-79, to priority level 1.


# lp -i asteroid-79 -q 1

Chapter 43 Managing Character Sets, Filters, Forms, and Fonts (Tasks)

This chapter provides background information and step-by-step instructions for setting up and administering character sets, print filters, forms, and fonts.

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

For overview information about printing, see Chapter 39, Print Management (Overview).

Managing Character Sets

Printers differ in the method they use to print text in various font styles. For example, PostScript printers treat text as graphics. These printers can generate text in different fonts, and place the text in any position, size, or orientation on the page. Other types of printers support a more limited number of font styles and sizes, using either print wheels, font cartridges, or preprogrammed selectable character sets. Usually, only one of these printing methods applies to a given printer type.

Print wheels and font cartridges, from the perspective of the LP print service, are similar, because someone must intervene and mount the hardware on the printer, when needed. Character sets that require you to physically mount a wheel or cartridge are referred to as hardware character sets. Character sets that do not require hardware mounting, that come preprogrammed with the printer, and can be selected by a print request, are referred to as software character sets.

When you set up a non-PostScript printer, you need to tell the LP print service which print wheels or selectable character sets are available to users. When users submit print requests, the lp -S command enables them to specify a print wheel or selectable character set to use for the print job. Users do not have to know which type of character set applies; they just refer to the font style by the name you have defined. For example, you may have defined a print wheel as gothic. To request the gothic print wheel, the user would enter lp -S gothic.

Selectable Character Sets

The selectable character sets supported by a printer are listed in the terminfo entry for that printer. For example, the entry for the ln03 printer is /usr/share/lib/terminfo/l/ln03. You can find the names of selectable character sets for any printer type in the terminfo database by using the tput command. The syntax for the tput command is:


tput -T printer-type csn

The csn option is an abbreviation for character set number. The number starts with 0, which is always the default character set number after the printer is initialized. You can repeat the command, using -1, -2, -3, and so on in place of the -0, to display the names of the other character sets. For each selectable character set, a terminfo name (for example, usascii, english, finnish, and so forth) is returned.

In general, the terminfo character set names should closely match the character set names used in the manufacturer's documentation for the printer. Because manufacturers do not all use the same character set names, the terminfo character set names may differ from one printer type to the next.

You do not have to register the selectable character set names with the LP print service. However, you can give them more meaningful names or aliases.


Note -

If you do not specify the selectable character sets that can be used with a printer, the LP print service assumes that the printer can accept any character set name (such as cs0, cs1, or cs2) or the terminfo name known for the printer.


Users can use the lpstat -p -l command to display the names of the selectable character sets that you have defined for each printer on a print server.


Note -

Character sets for PostScript printers are not listed when you use the lpstat -p -l command because the PostScript fonts are controlled by PostScript filters, not by entries in the terminfo database. See "Managing Fonts" for information about how to administer PostScript fonts.


Hardware-Mounted Character Sets

Another method to obtain alternative character sets is to use removable print wheels or font cartridges that you physically attach, or mount, in a printer.

To administer hardware-mounted character sets, you inform the LP print service of the names you want to use for the available print wheels, and how you want to be alerted when a printer needs a different print wheel. Then, when a user requests a particular character set with the lp -S command, the scheduler sends an alert to mount the print wheel, and the print request is placed in the print queue. When you mount the correct print wheel and tell the LP print service that the print wheel is mounted, the job is printed. See "How to Unmount and Mount a Print Wheel or Font Cartridge" for more information.

If you do not specify multiple print wheels or cartridges for a printer, the LP print service assumes that the printer has a single, fixed print wheel or cartridge, and users cannot specify a special print wheel or cartridge when using the printer.

Unlike selectable character sets, the names you use for print wheels or cartridges are not tied to entries in the terminfo database. Print wheel or cartridge names are used only for the purpose of communicating with the LP print service and its users.

The names you choose for print wheels or cartridges, however, should have meaning to the users; the names should refer to font styles. In addition, the names should be the same across printers that have similar print wheels or cartridges, or selectable character sets. That way, users can ask for a font style (character set) without regard to which printer--or even whether a print wheel or cartridges--or selectable character set will be used.

Of course, you and the printer users should agree on the meanings of print wheel or cartridge names. Otherwise, what a user asks for and what you mount, may not be the same character set.

Tracking Print Wheels

The procedure for tracking print wheels is similar to the procedure for tracking forms. Some printers (usually letter-quality printers) have removable print heads, such as print wheels or print cartridges, that provide a particular font or character set. A user can request a named character set. If that character set is not available, the LP print service notifies root of the request. The job is stored in the print queue until the print wheel is changed.

Alerts for Mounting Print Wheels or Cartridges

You request alerts for mounting print wheels or cartridges in the same way you request other alerts from the LP print service. See "Setting Up Printer Fault Alerts" for general information about alerts.

How to Define a Print Wheel or Font Cartridge

  1. Log in as superuser or lp on the print server.

  2. Define a print wheel or font cartridge that can be used with the printer.


    print-server# lpadmin -p printer-name -S hard-charset1[,hard-charset2...]
    
    -p printer-name
    

    Name of the printer for which you are defining a print wheel or font cartridge. 

    -s hard-charset
    

    Hardware character set name of the print wheel or font cartridge. 

    You can specify multiple hardware character sets with this command. Use commas or spaces to separate character set names. If you use spaces, enclose the list of character set names in quotes. 

    Define names that are meaningful to users, and inform the users of the names. 

    The print wheel or font cartridge definition is added in the print server's /etc/lp/printers/printer-name/configuration file.

  3. Log in as superuser or lp on a system that is a print client of the print server.

  4. Define the same print wheel or font cartridge for the print client.


    print-client# lpadmin -p printer-name -S hard-charset1[,hard-charset2...]
    

    In this command, the variables are the same as those in Step 2.

    The print wheel or font cartridge definition is added in the print client's /etc/lp/printers/printer-name/configuration file.

  5. Repeat Step 3and Step 4 for each print client that may need to use the print wheel or font cartridge.

  6. Verify the information following the Character sets heading in the following output is correct on both the print server and the print client.


    $ lpstat -p printer-name -l
    

Example--Defining a Print Wheel

In the following example, the command defines the pica print wheel on the printer luna for a print client named asteroid.


asteroid# lpadmin -p luna -S pica

How to Unmount and Mount a Print Wheel or Font Cartridge

  1. Log in as superuser or lp on the print server.

  2. Unmount the print wheel or font cartridge that is in the printer by using the lpadmin command.


    # lpadmin -p printer-name -M -S none
    
    -p printer-name
    

    Printer on which you are unmounting a print wheel or font cartridge. 

    -M -S none

    Specifies unmounting the current print wheel or font cartridge. 

    The current print wheel or font cartridge is deleted from the print server's /etc/lp/printers/printer-name/configuration file.

  3. Remove the print wheel or font cartridge from the printer.

  4. Put the new print wheel or font cartridge in the printer.

  5. Mount the new print wheel or font cartridge by using the lpadmin command.


    # lpadmin -p printer-name -M -S hard-charset
    
    -p printer-name
    

    Printer on which you are mounting a print wheel or font cartridge. 

    -M -S hard-charset
    

    Hardware character set name of the print wheel or font cartridge you want to mount. 

    The print wheel or font cartridge is added in the print server's /etc/lp/printers/printer-name/configuration file. The mounted print wheel or font cartridge remains active until it is unmounted or until a new print wheel or font cartridge is mounted.

  6. Check the information under the Print wheels or Character set heading in the output of the following command. You should see the name of the print wheel or character set and the notation (mounted)


    $ lpstat -p printer-name -l
    

Example--Unmounting and Mounting a Print Wheel

In the following example, the commands unmount the current print wheel on the printer luna and mount the pica print wheel.


# lpadmin -p luna -M -S none
# lpadmin -p luna -M -S pica

How to Set an Alert to Mount a Print Wheel or Font Cartridge

  1. Log in as superuser or lp on the print server.

  2. Set an alert to mount a print wheel or font cartridge by using the lpadmin command.


    # lpadmin -S hard-charset -A alert [-Q requests] [-W minutes]
    -S hard-charset
    

    Hardware character set name of the print wheel or font cartridge for which you want to set an alert.  

    -A alert
    

    Specifies what kind of alert will occur when a print wheel or font cartridge is requested. See Table 42-2 for detailed information about the valid values for alert. Some valid values are mail, write, and quiet.

    If you specify mail or write, a predefined alert message says to mount the specified print wheel or font cartridge and includes the names of one or more printers that have been set up to use such a print wheel or cartridge.

    -Q requests
    

    Specifies the number of print requests that require the print wheel or font cartridge that must be in the queue before an alert occurs. If you don't specify this option, only one print request in the queue triggers an alert. 

    -W minutes
    

    Specifies how often (in minutes) the alert will occur. If you don't specify this option, the alert is sent only once. 

    The alert is added in the print server's /etc/lp/pwheels/charset-name/alert.sh file.

  3. Verify that the alert has been added for the print wheel or font cartridge by checking the output of the following command.


    # lpadmin -S hard-charset -A list
    

    Otherwise, if you have set a low number of print requests to trigger the alert, submit enough print requests to meet the minimum requirement and make sure you receive an alert to mount the print wheel or font cartridge.

Examples--Setting an Alert to Mount a Print Wheel or Font Cartridge

In the following example, the command sets email alerts to occur every five minutes for the elite print wheel when there are ten print requests for elite in the print queue.


# lpadmin -S elite -A mail -Q 10 -W 5

In the following example, the command sets email alerts to occur every minute for the finnish font cartridge when there are five print requests for finnish in the print queue.


# lpadmin -S finnish -A mail -Q 5 -W 1

In the following example, the command sets console-window alerts to occur every 10 minutes for the elite print wheel when there are five print requests for elite in the print queue.


# lpadmin -S elite -A write -Q 5 -W 10

In the following example, the command sets no alerts to occur for the elite print wheel.


# lpadmin -S elite -A none

How to Set Up an Alias for a Selectable Character Set


Note -

You do not need to perform this procedure if the terminfo names for the selectable character sets are adequate. See "Adding a terminfo Entry for an Unsupported Printer", for more information on using the terminfo database.


  1. Log in as superuser or lp on the print server.

  2. Display the names of the selectable character sets for the specified printer type by using the tput command.


    # tput -T printer-type csn
    
    -T printer-type
    

    Printer type found in the terminfo database. See "Printer Type" for information on entries in the terminfo database.

    n
    

    Number (0, 1, 2, 3, 4, 5, and so on) that represents a selectable character set for the specified printer type. The system displays the selectable character set name followed by the prompt symbol. For example, cs1 could cause the system to display english#.

  3. Set up an alias for a selectable character set.


    # lpadmin -p printer-name -S select-charset1=alias1[,select-charset2=alias2...]
    
    -p printer-name
    

    Printer on which you are setting up aliases for selectable character sets. 

    -S select-charset
    

    Selectable character set name for which to set an alias. The name can be found in Step 2.

    alias
    

    Alias for the specified selectable character set. This alias can be used in addition to the selectable character set name. 

    You can set up more than one alias with this command. Use commas or spaces to separate the aliases. If you use spaces, enclose the list of aliases in quotes. 

    The alias is added in the print server's /etc/lp/printers/printer-name/configuration file.

  4. Log in as superuser or lp on a system that is a print client of the print server.

  5. Set up an alias for the selectable character set.


    # lpadmin -p printer-name -S select-charset1=alias1[,select-charset2=alias2...]
    

    In this command, the variables are the same as those in Step 3.

    The alias is added in the print client's /etc/lp/printers/printer-name/configuration file.

  6. Repeat Step 4and Step 5 for each print client that may need to use the alias.

  7. Verify that the selectable character set alias is listed in the output of the following command on the print server and print clients.


    $ lpstat -p printer-name -l
    

    Otherwise, submit a print request that uses the alias for the selectable character set and check for output.

Example--Setting Up an Alias for a Selectable Character Set

In the following example, the commands display the names of selectable character sets and specify text as an alias for the usascii selectable character set on the printer luna, which is an ln03 printer type.


# tput -T ln03 cs0
usascii# tput -T ln03 cs1
english# tput -T ln03 csn2
finnish# tput -T ln03 csn3
japanese# tput -T ln03 cs4
norwegian#
# lpadmin -p luna -S usascii=text

Managing Print Filters

Print filters are programs that convert the content type of a file to a content type that is acceptable to the destination printer.

The LP print service uses filters to:

Not every print filter can perform all these tasks. Because each task is printer-specific, the tasks can be implemented separately.

The LP print service provides the PostScript filters listed in Table 43-1. The filter programs are located in the /usr/lib/lp/postscript directory. For PostScript printing, you usually do not need to do anything beyond installing the filter programs when setting up a print server. Admintool automatically enables the supplied filters. However, if you administer other printers, you may need to administer print filters for them.

Creating Print Filters

To create a new print filter, you must write a print filter program and create a print filter definition. Filters contain input types, output types, and complex options that provide a language to process command-line arguments within the filter. See "Creating a New Print Filter" for background information and step-by-step instructions.

Adding, Changing, Removing, and Restoring Print Filters

Print filters are added, changed, or removed on the print server only.

You use the lpfilter command to manage the list of available filters. System information about filters is stored in the /etc/lp/filter.table file. The lpfilter command gets the information about filters to write to the table from filter descriptor files. The filter descriptor files supplied (PostScript only) are located in the /etc/lp/fd directory. The actual filter programs are located under /usr/lib/lp.

The LP print service imposes no fixed limit on the number of print filters you can define. You may remove filters that are no longer used to avoid extra processing by the LP print service. (LP examines all filters to find one that works for a specific print request.) If in doubt, do not remove a filter.

As you add, change, or delete filters, you may overwrite or remove some of the original filters provided by the LP print service. You can restore the original set of filters, if necessary, and remove any filters you have added.

SunOS 5.x system software provides a default set of PostScript filters, which Admintool automatically adds to a print server. Some of the TranScript filters used with SunOS 4.1 have SunOS 5.x equivalents, but others do not. Table 43-1 lists the default PostScript filters and identifies the TranScript filters, where applicable.

Table 43-1 Default PostScript Filters

Filter 

Action 

TranScript Equivalent 

download

Download fonts 

 

dpost

ditroff to PostScript

psdit

postdaisy

daisy to PostScript

 

postdmd

dmd to PostScript

 

postio

Serial interface for PostScript printer 

pscomm

postior

Communicate with printer 

 

postmd

Matrix gray scales to PostScript 

 

postplot

plot to PostScript

psplot

postprint

simple to PostScript

enscript

postreverse

Reverse or select pages 

psrev

posttek

TEK4014 to PostScript 

ps4014

SunOS 5.x does not provide the following filters:

The postreverse, postprint, postio, and dpost filters are provided in place of Enscript.

Admintool adds the default PostScript filters to a print server. If you have printing needs that are not met by these filters, see "How to Create a New Print Filter" for information about writing a custom print filter.

How to Add a Print Filter

  1. Log in as superuser or lp on the print server.

  2. Add a print filter that is based on a print filter definition by using the lpfilter command.


    # lpfilter -f filter-name -F filter-def
    
    -f filter-name
    

    Name you choose for the print filter. 

    -F filter-def
    

    Name of the print filter definition. 

    The print filter is added in the print server's /etc/lp/filter.table file.

  3. Verify that the print filter was added by checking for information about the print filter in the output of the following command.


    # lpfilter -f filter-name -l
    

Example--Adding a Print Filter

In the following example, the command adds the daisytroff print filter that has the daisytroff.fd print filter definition.


# lpfilter -f daisytroff -F /etc/lp/fd/daisytroff.fd

How to Delete a Print Filter

  1. Log in as superuser or lp on the print server.

  2. Delete the print filter by using the lpfilter command.


    # lpfilter -f filter-name -x
    
    -f filter-name
    

    Name of the print filter to be deleted. 

    -x

    Deletes the specified filter. 

    The print filter is deleted from the print server's /etc/lp/filter.table file.

  3. Verify that filter was deleted by using the following command. You should receive an error indicating that no filter by the specified name exists.


    # lpfilter -f filter-name -l
    

Example--Deleting a Print Filter

In the following example, the command deletes the daisytroff print filter.


# lpfilter -f daisytroff -x

How to View Information About a Print Filter

  1. Log in as superuser or lp on the print server.

  2. Request information about a print filter by using the lpfilter command.


    # lpfilter -f filter-name -l
    
    -f filter-name
    

    Print filter for which you want to view information. Specify all for filter-name to view information about all the available print filters.

    -l

    Displays information about the specified filter. 

    Information about the specified print filter(s) is displayed.

Examples--Viewing Information About a Print Filter

In the following example, the command requests information for the postdaisy print filter, and the information that is displayed in response.


# lpfilter -f postdaisy -l
Input types: daisy
Output types: postscript
Printer types: any
Printers: any
Filter type: slow
Command: /usr/lib/lp/postscript/postdaisy
Options: PAGES * = -o*
Options: COPIES * = -c*
Options: MODES group = -n2
Options: MODES group\=\([2-9]\) = -n\1
Options: MODES portrait = -pp
Options: MODES landscape = -pl
Options: MODES x\=\(\-*[\.0-9]*\) = -x\1
Options: MODES y\=\(\-*[\.0-9]*\) = -y\1
Options: MODES magnify\=\([\.0-9]*\) = -m\1

In the following example, the command redirects information about the daisytroff filter to a file (creates the filter definition for that filter). This is useful if a filter definition is removed unintentionally.


# lpfilter -f daisytroff -l > daisytroff.fd

In the following example, the command displays all the print filters that have been added to the system, and the information that is displayed in response.


# lpfilter -f all -l | grep Filter
(Filter "download")
Filter type: fast
(Filter "postio")
Filter type: fast
(Filter "postior")
Filter type: fast
(Filter "postreverse")
Filter type: slow

Managing Forms

A form is a sheet of paper on which information is printed in a predetermined format. Unlike plain paper stock, forms usually have text or graphics preprinted on them. Common examples of forms are company letterhead, invoices, blank checks, receipts, and labels.

The term form has two meanings: the physical medium (the paper) and the software that defines a form to the LP print service.

The LP print service allows you to control the use of forms. This section provides information about adding, changing, removing, mounting, and controlling access to forms.

Adding, Changing, or Deleting Forms

When you add a form, you tell the LP print service to include the form in its list of available forms. You also have to supply the information required to describe or define the form. Although you can enter such definitions when you add the form, it helps to create the definitions first and save them in files. You can then change the form definition by editing the file. See "How to Create a New Form Definition" for information about how to create form definitions.


Note -

No form definitions are supplied with the LP print service.


To change a form, you must re-add the form with a different definition.

The LP print service imposes no limit on the number of forms you can define. However, you should delete forms that are no longer appropriate. Obsolete forms may result in unnecessary processing by the print service.

Mounting Forms

To print a form, you must load the paper in the printer and use a command to mount the form, which notifies the LP print service that print requests submitted to the printer are to be printed using the form definition. If you use one printer for different types of printing, including forms, you should:

When you mount a form, make sure it is aligned properly. If an alignment pattern has been defined for the form, you can request that the pattern print repeatedly after you have mounted the form, until you have adjusted the printer so the alignment is correct.

When you want to change or discontinue using a form on a printer, you must notify the LP print service by unmounting the form.

Tracking Forms

The LP print service helps you track which forms are mounted on each printer and notifies you when it cannot find a description it needs to print a form. You are responsible for creating form descriptions and mounting and unmounting form paper in each printer, either as part of setting up a printer or in response to alerts from the LP print service.

Users can specify the form on which they want a job to print. As root, you can mount a specific form, then tell the LP print service that the form is available and on which printer it is mounted. Users can submit print requests specifying a particular form. When the LP print service receives the request, it sends an alert message to root requesting that you mount the form.

Defining Alerts for Mounting Forms

You request alerts for mounting forms in the same way you request other alerts from the LP print service. See "Setting Up Printer Fault Alerts" for general information about alerts.

Checking Forms

When you have defined a form for the LP print service, you can check it with either of two commands, depending on the type of information you want to check.

If you are not sure about the name of an existing form, you can list the contents of the /etc/lp/forms directory to see the names of the forms there.

Limiting Access to Forms

You can control which printers and users have access to some or all of the forms available on the network. For example, you may want only the people in the payroll or accounts payable department to be able to print check forms. In addition, you may want the check forms to be available only on certain printers.

To limit user access to forms, see "How to Limit User Access to a Form". To limit printer access to a form, see "How to Limit Printer Access to a Form".

How to Add a Form

  1. Log in as superuser or lp on the print server.

  2. Add a form that is based on a form definition by using the lpforms command.


    # lpforms -f form-name -F /etc/lp/forms/form
    
    -f form-name
    

    Name you choose for the form.  

    -F /etc/lp/forms/form
    

    Name of the form definition. 

    The form is added in the print server's /etc/lp/forms/form-name/describe file.

  3. Verify that the form was added by checking for a listing of information about the form in the output of the following command.


    # lpforms -f form-name -l
    

Example--Adding a Form

In the following example, the command adds the medical form that uses the medical.fmd form definition.


# lpforms -f medical -F /etc/lp/forms/medical.fmd

Note -

Before the form can be used, one or more printers must be given access to the form. See "How to Limit Printer Access to a Form".


How to Delete a Form

  1. Log in as superuser or lp on the print server.

  2. Delete the form by using the lpforms command.


    # lpforms -f form-name -x
    
    -f form-name
    

    Form to be deleted. 

    -x

    Deletes the specified form. 

    The form is deleted from /etc/lp/forms/form-name file.

  3. Verify that form was deleted by using the following command. You should receive an error indicating that a form by the specified name does not exist.


    # lpforms -f form-name -l
    

Example--Deleting a Form

In the following example, the command deletes the medical form.


# lpforms -f medical -x

How to Unmount and Mount a Form

  1. Log in as superuser or lp on the print server.

  2. Stop accepting print requests on the printer on which you are unmounting the current form by using the reject command.


    # reject printer-name
    

    printer-name

    Name of the printer on which you are unmounting a form. 

    New print requests (which may not require the form) are not allowed to enter the printer's queue.

  3. Unmount the current form by using the lpadmin command.


    # lpadmin -p printer-name -M -f none
    

    In this command, the variable printer-name is the same as in Step 2.

    The current form is deleted from the print server's /etc/lp/printers/printer-name/configuration file.

  4. Remove the form paper from the printer.

  5. Load the form paper for the next print request.

  6. Mount the form by using the lpadmin command.


    # lpadmin -p printer-name -M -f form-name[-a -o filebreak]
    -p printer-name
    

    Printer on which you are mounting a form. 

    -M -f form-name
    

    Name of the form to be mounted. 

    -a -o filebreak 
    

    Optionally enables you to print a copy of the alignment pattern defined for the form, if it has one. 

    The specified form is added in the print server's /etc/lp/printers/printer-name/configuration file.

  7. Start accepting print requests on the printer.


    # accept printer-name
    

    The printer is ready to print the form you just mounted.

  8. Verify that the form has been mounted by checking for the form name under the Form mounted heading in the output of the following command.


    $ lpstat -p printer-name -l
    

    Otherwise, submit a print request that requires the new form and check the printer for output.

Examples--Unmounting and Mounting a Form

The following example shows the process of unmounting the currently mounted form on the printer luna.


# reject luna
destination "luna" will no longer accept requests
# lpadmin -p luna -M f none
# accept luna
destination "luna" now accepting requests

The following example shows the process of mounting the medical form on the printer luna.


# reject luna
destination "luna" will no longer accept requests
# lpadmin -p luna -M f medical -a -o filebreak
# accept luna
destination "luna" now accepting requests

How to Set an Alert to Mount a Form

  1. Log in as superuser or lp on the print server.

  2. Set a request alert for mounting a form by using the lpadmin command.


    # lpforms -f form-name -A alert [-Q requests] [-W minutes]
    -f form-name
    

    Form for which you want to set a request alert.  

    -A alert
    

    Specifies what kind of alert will occur when a form is requested. See Table 42-2for detailed information about the valid values for alert. Some valid values are mail, write, and quiet. If you choose mail or write, a predefined alert message says to mount the specified form and includes the names of one or more printers that have been set up to use the form.

    -Q requests
    

    Specifies how many print requests that require the form must be in the queue to trigger an alert. If you don't specify this option, an alert occurs with just one print request in the queue. 

    -W minutes
    

    Specifies how often (in minutes) the alert will occur. If you don't specify this option, the alert is sent once. 

    The request alert is added in the print server's /etc/lp/forms/form-name/alert.sh file.

  3. Verify that the alert has been added for the form by checking the output of the following command.


    # lpforms -f form-name -A list
    

    Otherwise, if you have set a low number of print requests to trigger the alert, submit print requests to meet the minimum requirement and make sure you receive an alert to mount the form.

Examples--Setting an Alert to Mount a Form

In the following example, the command sets email alerts to occur every five minutes for the letterhead form when there are 10 print requests for letterhead in the print queue.


# lpforms -f letterhead -A mail -Q 10 -W 5

In the following example, the command sets console window alerts to occur every 10 minutes for the letterhead form when there are five requests for letterhead in the print queue.


# lpforms -f letterhead -A write -Q 5 -W 10

In the following example, the command sets no request alerts for the invoice form.


# lpforms -f invoice -A none

How to View Information About a Form

  1. Log in as superuser or lp on the print server.

  2. Request information about a form by using the lpforms command.


    # lpforms -f form-name -l
    
    -f form-name
    

     

    Form for which you want to view information. Specify all for form-name to view information about all the available forms.

    -l

    Lists the specified form. 

    Information about the specified form(s) is displayed.

Examples--Viewing Information About a Form

In the following example, the command displays information about the medical form.


# lpforms -f medical -l
Page length: 62
Page width: 72
Number of pages: 2
Line pitch: 6
Character pitch: 12
Character set choice: pica
Ribbon color: black
Comment:
Medical claim form

In the following example, the command redirects the information about the medical form to a file. (This command creates the form definition for the form.) This is useful if a form definition gets removed unintentionally.


# lpforms -f medical -l > medical.fmd

How to View the Current Status of a Form

  1. Log in on the print server.

  2. Request information about the current status of a form by using the lpstat command.


    $ lpstat -f form-name
    

    -f form-name

    Form for which you want to view the current status. Specify all for form-name to view the current status of all the forms.

    Information about the current status of the specified form(s) is displayed.

Example--Viewing the Current Status of a Form

In the following example, the command displays the status of the medical form.


$ lpstat -f medical,payroll
form medical is available to you

How to Limit User Access to a Form

  1. Log in as superuser or lp on the print server.

  2. Allow or deny users access to a form by using the lpforms command.


    # lpforms -f form-name -u allow:user-list | deny:user-list
    
    -f form-name
    

    Name of the form for which the allow or deny user access list is being created. 

    -u allow:user-list
    

    Represents users to be added to the allow access list. Use a comma or a space to separate users' login IDs. If you use spaces, enclose the list of IDs in quotes.  

    Table 42-4 provides the valid values for user-list.

    | -deny:user-list
    

    Represents users to be added to the deny user access list. Use a comma or a space to separate users' login IDs. If you use spaces, enclose the list of IDs in quotes. Table 42-4 provides the valid values for user-list.

    The specified user(s) are added to the allow or deny user access list for the specified form in one of the following files on the print server:

    /etc/lp/forms/form-name/allow  /etc/lp/forms/form-name/deny 
    

  3. Verify the allow and deny user access lists by using the lpforms command.


    # lpforms -f form-name -l
    

Examples--Limiting User Access to a Form

In the following example, the command allows only the users nathan and marcia access to the check form.


# lpforms -f check -u allow:nathan,marcia

In the following example, the command denies users jones and smith access to the dental form.


# lpforms -f dental -u deny:"jones,smith"

How to Limit Printer Access to a Form

  1. Log in as superuser or lp on the print server.

  2. Allow or deny use of forms on a printer by using the lpadmin command.


    # lpadmin -p printer-name -f allow:form-list | deny:form-list
    
    -p printer-name
    

    Name of the printer for which the allow or deny forms list is being created. 

    -f allow:form-list | deny:form-list
    

    Form names to be added to the allow or deny list. Use a space or a comma to separate multiple form names. If you use spaces to separate form names, enclose the list of form names in quotes. 

    The specified form(s) are added to the allow or deny forms list in one of the following files on the print server:

    /etc/lp/printers/printer-name/form.allow  /etc/lp/printers/printer-name/form.deny 
    

  3. Verify the allow and deny forms lists by using the following command.


    # lpstat -p printer-name -l
    

Examples--Limiting Printer Access to a Form

In the following example, the command allows the printer luna to access only the medical, dental, and check forms.


# lpadmin -p luna -f allow:medical,dental,check

In the following example, the command denies the printer luna from accessing the medical, dental, and check forms.


# lpadmin -p luna -f deny:"medical dental payroll"

Managing Fonts

If you have a laser printer, you may need to install and maintain PostScript fonts. You may also have to decide where to install PostScript fonts and how to manage them. For many printers, the fonts are set up as part of the printer installation process.

PostScript fonts are stored in outline form, either on the printer or on a system that communicates with the printer. When a document is printed, the PostScript interpreter generates each character as needed (in the appropriate size) from the outline description of it. If a font required for a document is not stored on the printer being used, it must be transmitted to that printer before the document can be printed. This transmission process is called downloading fonts.

Fonts are stored and accessed in several ways:

Managing Printer-Resident Fonts

Most PostScript printers come equipped with fonts resident in the printer ROM. Some printers have a disk on which additional fonts are stored. When a printer is installed, you should add the list of printer-resident fonts to the font list for that printer. By identifying printer-resident fonts, you prevent fonts from being transmitted unnecessarily across a network. Each printer has its own list of resident fonts, which is contained in the file:


/etc/lp/printers/printer-name/residentfonts

When the printer is attached to a print server, make sure the list in the residentfonts file includes fonts that are on the print server and which are available for downloading to the printer.

You must edit the files containing the list of printer-resident fonts by using a text editor such as vi.

Downloading Host-Resident Fonts

When a PostScript document contains a request for fonts not loaded on the printer, the download filter manages this request. The download filter uses PostScript document structuring conventions to determine which fonts to download.

LP print filters are either fast or slow. A fast filter quickly prepares a file for printing, and it must have access to the printer while the filter is processing. A slow filter takes longer to convert a file, and it does not need to access the printer while the filter is processing. An example of a slow filter is ASCII to PostScript.

The download filter is a fast filter; it downloads fonts automatically if the fonts are on the print server. The download filter may also be used to send fonts to a print server. To do this, you may create a new filter table entry that calls the download filter as a slow filter by using the -y option of the lp command. Alternatively, you may force selection of this filter by changing the input type.

The download filter performs five tasks:

  1. It searches the PostScript document to determine which fonts are requested. These requests are documented with the following PostScript structuring comments: %%DocumentFonts: font1 font2 ... in the header comments.

  2. It searches the list of printer-resident fonts to determine if the requested font must be downloaded.

  3. If the font is not resident on the printer, the download filter searches the host-resident font directory (by getting the appropriate file name from the map table) to determine if the requested font is available.

  4. If the font is available, the filter takes the file for that font and appends it to the file to be printed.

  5. It sends the font definition file and the source file (the file to be printed) to the PostScript printer.

Installing and Maintaining Host-Resident Fonts

Some fonts reside on the host system and are transmitted to the printer as needed for particular print requests. As the administrator, you make PostScript fonts available to all users on a system. To do so, you must know how and where to install these fonts. Because fonts are requested by name and stored in files, the LP print service keeps a map file that shows the correspondence between the names of fonts and the names of the files containing those fonts. Both the map and the font list must be updated when you install host-resident fonts.

The fonts available for use with PostScript printers are stored in directories you create called /usr/share/lib/hostfontdir/typeface/font, where typeface is replaced by a name like palatino or helvetica, and font is replaced by a name like bold or italic.

How to Install Downloaded PostScript Fonts

  1. Log in as superuser or lp on the print server or print client.

  2. Change directory to the /etc/lp/printers/printer-name directory.


    # cd /etc/lp/printers/printer-name
    

    printer-name

    Name of the printer on which you want to install downloaded PostScript fonts. 

  3. Create the residentfonts file, if it does not already exist.


    # touch residentfonts
    

    This file may not exist if this is the first time you are adding permanently downloaded fonts.

  4. Edit the residentfonts file by adding all the printer-resident fonts and fonts to be permanently downloaded.

    You can use any text editor, such as vi.

  5. Save the file.

How to Install Host-Resident PostScript Fonts

  1. Log in as superuser or lp on the print server or print client.

  2. Create the hostfontdir directory, if it does not already exist.


    # cd /usr/share/lib
    # mkdir hostfontdir
    # chmod 775 hostfontdir
    
  3. Create a directory for a new typeface, if the directory does not already exist.


    # mkdir typeface
    
  4. Copy the font file to the appropriate directory.


    # cp filename /usr/share/lib/hostfontdir/typeface/font
    
  5. Add the name of the font and the name of the file in which it resides to the map table.

    1. Change to the /usr/share/lib/hostfontdir directory.

    2. Edit the map file using a text editor such as vi.

      Add a one-line entry for each font you want to add to the table, with the font name first, followed by a space, followed by the name of the file where the font resides. For example:


      Palatino-Bold /usr/share/lib/hostfontdir/palatino/bold
      
    3. Save the file.

      When an example entry exists in the map table on the appropriate system, users will be able to apply the font (for example, Palatino Bold) in their print jobs. When they submit a print request containing this font, the LP print service appends a copy of the file /usr/share/lib/hostfontdir/palatino/bold to that file before sending it to the printer.

  6. If you are using troff, you must create new width tables for this font in the standard troff font directory.

Chapter 44 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 39, Print Management (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.

Table 44-1 shows the default stty settings used by the LP print service.

Table 44-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 or lp on the print server.

  2. Adjust the printer port characteristics by using the lpadmin command.


    # 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. See stty(1) for a complete list of options. Table 44-1 shows the default stty settings used by the LP print service.

  3. Verify that the printer port characteristics have been changed by using the following command.


    # stty -a
    

Examples--Adjusting the Printer Port Characteristics

In the following example, the command sets 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'"

In the following example, the command sets 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 /usr/share/lib/terminfo/P. The default entries provided with the SunOS 5.x system are PS (for PostScript) and PSR (for PostScript Reverse).

If you cannot find a terminfo entry for your printer, you still may be able to use the printer with the LP print service without the automatic selection of page size, pitch, and character sets. However, you may 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. Table 44-2 lists the required terminfo items for a printer.

Table 44-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 

How to Add a terminfo Entry for an Unsupported Printer


Note -

Before you create a terminfo entry for a printer, you should first make sure none of the existing terminfo entries will support the printer. To do so, try to set up the printer with an entry for a similar printer, if there is one.


  1. Log in as superuser or lp on the print server.

  1. Determine a terminfo entry name for the printer.

    The directories in the /usr/share/lib/terminfo directory contain all the valid terminfo entries. Use them as a guide for choosing a name for the printer.

  2. Create a terminfo entry file for the printer.

    Table 44-2 shows the items you must define in the terminfo entry to add a new printer to the LP print service. For more details about the structure of the terminfo database, see terminfo(4).

    To help you start writing a new terminfo entry, use the infocmp command to save an existing terminfo entry to a file. This is helpful if there is a terminfo entry that is similar to one you want to create. For example, the following command saves the ps entry to the ps_cust file, which will become the new terminfo entry.

    infocmp ps > ps_cust

  3. Compile the terminfo entry file into the terminfo database.


    # tic terminfo_entry
    

    terminfo_entry

    The terminfo entry file you created.

  4. Check for the new terminfo entry file in the /usr/share/lib/terminfo directory.

Customizing the Printer Interface Program

If you have a printer that is not supported by the standard printer interface program, you can furnish your own printer interface program. You can copy the standard program and then tell the LP print service to use it for a specified printer. But first you need to understand what is in the standard program. The following section describes the standard program.

A printer interface program should:


Caution - Caution -

If you have a printer interface program from a release of UNIX System V prior to Release 3.2, it will probably work with the SunOS 5.x LP print service. However, several -o options have been standardized in the SunOS 5.x LP print service and will be passed to every printer interface program. These options may interfere with similarly named options used by the old interface.


The LP print service, not a printer interface program, is responsible for opening the printer port. The printer port is given to the printer interface program as standard output, and the printer is identified as the "controlling terminal" for the printer interface program so that a "hang-up" of the port will cause a SIGHUP signal to be sent to the printer interface program.

The Standard Printer Interface Program

The standard (model) printer interface program, /usr/lib/lp/model/standard, is used by the LP print service to set the printing defaults shown in Table 44-3.

Table 44-3 Default Printer Port Characteristics

Characteristic 

Default Setting 

Default filter 

None

Character pitch 

None

Line pitch 

None

Page width 

None

Page length 

None

Character set 

None

stty options

9600 cs8 -cstopb -parenb -parodd ixon -ixany opost -olcuc onlcr -ocrnl -onocr -onlret -ofill nl0 cr0 tab0 bs0 vt0 ff0

Exit code

0

Customizing stty Modes

If you need to change the terminal characteristics, like baud rate or output options, look for the section of the standard printer interface program that begins with the following comment:

## Initialize the printer port

Exit Codes

When printing is complete, your interface program should exit with a code that shows the status of the print job. The exit code is the last entry in the printer interface program.

Table 44-4 shows the exit codes and how they are interpreted by the LP print service.

Table 44-4 Printer Interface Program Exit Codes

Code 

Meaning to the LP Print Service 

0

The print request has been successfully completed. If a printer fault occurred, it has been cleared. 

1 to 127

A problem was encountered when printing a request (for example, too many nonprintable characters or the request exceeds the printer capabilities). The LP print service notifies the person who submitted the request that there was an error when printing it. This error will not affect future print requests. If a printer fault has occurred, it has been cleared. 

128

This code is reserved for internal use by the LP print service. Interface programs must not exit with this code. 

129

A printer fault was encountered when printing the request. This fault will affect future print requests. If the fault recovery for the printer directs the LP print service to wait for the administrator to correct the problem, the LP print service disables the printer. If the fault recovery is to continue printing, the LP print service will not disable the printer, but it will try printing again in a few minutes. 

>129

These codes are reserved for internal use by the LP print service. Interface programs must not exit with codes in this range. 

If the program exits with a code of 129, root is alerted of a printer fault. The LP print service must also reprint the request from the beginning, after the fault has been cleared. If you do not want the entire request to be reprinted, you can have the interface program send a fault message to the LP print service, but wait for the fault to be cleared. When the fault is cleared, the interface program can resume printing the file. When printing is finished, the printer interface program can give a zero exit code, just as if the fault had never occurred. An added advantage of this approach is that the interface program can detect when the fault is cleared automatically, so that the administrator does not need to re-enable the printer.

Fault Messages

You can use the lp.tell program to send fault messages to the LP print service. This program is referenced by the LPTELL shell variable in the standard printer interface code. The program takes standard input and sends it to the LP print service, where it is put into the message that alerts the administrator to the printer fault. If its standard input is empty, lp.tell does not initiate an alert. For an example of how the lp.tell program is used, examine the standard printer interface code immediately after the following comment:

# Here's where we set up the $LPTELL program to capture fault messages

If you use the special exit code 129 or the lp.tell program, the printer interface program does not need to disable the printer itself. The interface program can disable the printer directly, but doing so will override the fault-alerting mechanism. Alerts are sent only if the LP print service detects that the printer has a fault, and the special exit code and the lp.tell program are its main detection tools.

If the LP print service has to interrupt printing of a file at any time, it kills the interface program with a signal TERM (trap number 15). (See kill(1) and signal(3B).) If the printer interface program dies from receipt of any other signal, the LP print service assumes that future print requests will not be affected, and continues to use the printer. The LP print service notifies the user who submitted the request that the request has not been finished successfully.

When the interface is first invoked, the signals HUP, INT, QUIT, and PIPE (trap numbers 1, 2, 3, and 13) are ignored. The standard interface changes this so the signals are trapped at appropriate times. The standard interface interprets receipt of these signals as warnings that the printer has a problem; when it receives a signal, it issues a fault alert.

Using a Customized Printer Interface Program

You can create a customized printer interface program and use it in place of the standard printer interface program on the print server. To do so, you use the lpadmin command to register the program with the LP print service for a specific printer.

How to Set Up a Custom Printer Interface Program

  1. Log in as superuser or lp on the print server.

  2. Find your next step based on whether you have a custom printer interface program.

    If You ... 

    Then ... 

    Need to create a custom printer interface program 

    Go to Step 3.

    Already have a custom printer interface program 

    Go to Step 5.

  3. Copy the standard printer interface program.


    # cp /var/spool/lp/model/standard custom-interface
    
  4. Change the copy of the standard printer interface program to meet your needs.

    Refer to the description of the program in "The Standard Printer Interface Program" to determine what you need to change.

  5. Set up the custom printer interface program for a specific printer.


    # lpadmin -p printer-name -i custom-interface
    
    -p printer-name
    

    The printer that will use the custom printer interface program. 

    -i custom-interface
    

    Name of the custom printer interface program. 

    The custom printer interface program is registered with the LP print service, and will be used by that printer when users submit print requests.

  6. Verify that the custom printer interface program has been added in the /etc/lp/printers/printer-name/configuration file.

Examples--Setting Up a Custom Printer Interface Program

In the following example, the command sets up a custom printer interface program named custom for the printer luna.


# lpadmin -p luna -i custom

In the following example, the command sets up a custom printer interface program that the system venus is using on the printer asteroid.


# lpadmin -p asteroid -e venus

Creating a New Print Filter

A filter is used by the LP print service each time it has to print a type of file that the printer cannot interpret. Creating a new print filter is not easy; it usually requires extensive experimentation. The process of defining a new print filter consists of two steps:

A print filter can be as simple or as complex as needed. Filters contain input types, output types, and complex options that provide a language to process command-line arguments within the filter.

If you have non-PostScript printers, you have to create and add print filters as required. First, you need to understand what print filters are and the requirements that must be met by a filter program.

Writing a Print Filter Program

The SunOS 5.x print service provides filter programs in the /usr/lib/lp/postscript directory. These filters cover most PostScript printing situations--where the destination printer requires the data to be in PostScript format. A print filter program must be a binary executable.

Types of Filters

There are two types of print filters: fast filters and slow filters.

Fast filters do not require much processing time to prepare a file for printing. They must have access to the printer when they run. To be capable of detecting printer faults, a print filter must be a fast filter. Any filter that uses the PRINTER keyword as a filter option must be installed as a fast filter.

Slow filters require a great deal of processing time to prepare a file for printing. They do not require access to the printer when they run. Slow filters are run in the background so they do not tie up the printer, allowing other files that do not need slow filtering to be printed.

Converting Files

The LP print service uses print filters to convert files from one content type to another. You can specify the accepted file content types for each printer. The user specifies the file content type when submitting a print request, and the LP print service finds a printer that can print files of that content type. Because many applications can generate files for various printers, this is often sufficient. However, some applications may generate files that cannot be printed on any available printers.

Each time the LP print service receives a request to print a type of file that is in a format that cannot be accepted directly by a printer, the LP print service tries to match the content type of the print request with the content type of the available (or specified) printer. If there is a match, the file can be sent directly to the printer without filtering. If no match is found, or if the content type specifies that a filter be used, the LP print service tries to match the content type of the file with the input content type of available filters, and match the output type of the filter with the content type of the printer. When an appropriate filter is found, the print request is passed through the filter.

Handling Special Printing Modes

A print filter handles special modes and requests to print specific pages. A special printing mode is needed to print any characteristics of print requests that require a customized filter. Filters handle the following characteristics:

The LP print service provides default settings for these characteristics; however, a print filter may handle some characteristics more efficiently. For example, some printers can handle multiple copies more efficiently than the LP print service, and, in this case, you may want to provide a filter for multiple-copy page control.

Detecting Printer Faults

Each printer has its own way of detecting printer faults and transmitting fault signals to the LP print service. The LP print service only checks for hang-ups (loss of carrier) and excessive delays in printing.

Some printers provide good fault coverage and can send a message describing the reason for a fault. Other printers indicate a fault by using signals other than the signals indicating loss of carrier signal or shut off of data flow. A filter is required to interpret this additional printer fault information.

A filter can also put a print request on hold, wait for a printer fault to clear, and then resume printing. With this capability, the print request that was interrupted does not need to be reprinted in its entirety. Only a filter that knows the control sequences used by a printer can determine where to break a file into pages. Consequently, only such a filter can find the place in the file where printing should start after a fault is cleared.

When a print filter generates messages, those messages are handled by the LP print service, and alerts are sent to the system administrator if alerts are enabled. For further information, see "Setting Up Printer Fault Alerts".

Requirements for a Print Filter Program

A print filter can be simple or complex, but it has to meet the following requirements:

If you want the filter to detect printer faults, it should also meet the following requirements:

Creating a Print Filter Definition

A print filter definition tells the LP print service about the filter, what print filter program to run, what kind of conversion it does, and so on. A set of filter descriptor files are provided in the /etc/lp/fd directory. These files describe the characteristics of the filters (for example, fast or slow filter), and point to the filter programs (for example, /usr/lib/lp/postscript/postdaisy).

When defining a new print filter, in addition to writing a filter program, you must create a print filter definition. A print filter definition contains the following information used by the LP print service:

You can type the characteristics as direct input to the lpfilter command. You also can create a file that specifies the filter's characteristics, and use the file name as input to the lpfilter command. Such a file is called a filter descriptor file and should be located in the /etc/lp/fd directory. These files are not the filters themselves, but rather point to the filters.

Whether you store the information in a file, or enter it directly on the command line, use the following format:


Command: command-pathname [options]
Input types: input-type-list
Output types: output-type-list
Printer types: printer-type-list
Printers: printer-list
Filter type: fast or slow
Options: template-list

Note -

If you provide more than one definition (that is, more than one line) for any filter characteristic other than Options, only the second definition will be used by the print service.


The information can be arranged in any order, and not all the information is required. When you do not specify values, those shown in Table 44-5 are assigned by default. They are not very useful, which is why you should specify explicit values.

Table 44-5 Default Values for lpfilter Arguments

Item 

Default 

Input types 

any

Output type 

any

Printer types 

any

Printers 

any

Filter type 

slow

Command

Use the full path of the filter program. If there are any fixed options that the program always needs, include them here.

Input Types

Input types is a list of file content types that the print filter can process. The LP print service does limit the number of input types, but most filters can accept only one type. Several file types may be similar enough that the filter can deal with them. You can use whatever names you like, with a maximum of 14 alphanumeric characters and dashes. Do not use underscores as part of the input type name.

The LP print service uses these names to match a filter to a file type, so follow a consistent naming convention. For example, if more than one filter can accept the same input type, use the same name for that input type when you specify it for each filter. Inform your users of these names so they know how to identify the file type when submitting a file for printing.

Output Types

Output types is list of file types that the filter can produce as output. For each input type, the filter produces a single output type. The output type may vary, however, from job to job. The name of the output type is restricted to 14 alphanumeric characters and dashes.

The output type names should either match the types of available (local or remote) printers, or match the input types handled by other filters. The LP print service groups filters in a shell pipeline if it finds that several passes by different filters are needed to convert a file. It is unlikely that you will need this level of sophistication, but the LP print service allows it. Try to find a set of filters that takes as input types all the different files the users may want printed, and that converts those files directly into file types the printer can handle.

Printer Types

Printer types is a list of the types of printers into which the print filter can convert files. For most printers and filters, you can leave this part of the filter definition blank, because it is identical to the list of output types. But it can be different. For example, you could have a printer with a single printer type for purposes of initialization, but which can recognize several different file content types. Essentially, this printer has an internal filter that converts the various file types into one that it can handle. Thus, a filter may produce one of several output types that match the file types that the printer can handle. The print filter should be marked as working with that printer type.

As another example, you may have two different models of printers that are listed as accepting the same file types. Due to slight differences in manufacture, however, one printer deviates in the results it produces. You label the printers as being of different printer types, say A and B, where B is the one that deviates. You create a filter that adjusts files to account for the deviation produced by printers of type B. Because this filter is needed only for those printer types, you would list it as working only on type B printers.

Printers

A print filter is normally able to work with all printers that accept its output, so you can usually skip this part of the filter definition.

You may, however, have some printers that are or inappropriate for the output that the filter produces. For example, you may want to dedicate one printer for fast turnaround, only sending files that require no filtering to that printer. Other printers of identical type may be used for files that need extensive filtering before they can be printed.

Filter Type

The LP print service recognizes fast and slow filters, as described in "Types of Filters".

Slow filters that are invoked by printing modes (using the -y option of the lp command) must be run on the system from which the print request originated. The LP print service cannot pass values for modes to print servers. It can, however, match a file content type (specified after the -T option of the lp command) to a content type on a print server. Therefore, if you want to activate special modes on a print server, you must specify content types that permit the LP print service to match input types and output types.

Options

Options specify how different types of information are converted into command-line arguments to the filter command. This information may include specifications from a user (with the print request), the printer definition, and the specifications implemented by any filters used to process the request.

Defining Print Filter Options With Templates

There are 13 sources of information for defining print filter options, each of which is represented by a keyword. Each option is defined in a template. A template is a statement in a filter definition that defines an option to be passed to the filter command, based on the value of one of the characteristics of the filter.

The options specified in a filter definition may include none, all, or any subset of the 13 keywords. In addition, a single keyword may be defined more than once, if multiple definitions are required for a complete filter definition. Table 44-6 contains descriptions of the 13 keywords available for defining Options in a print filter definition.

Table 44-6 Print Filter Options Keywords

Characteristic

Keyword 

Possible Patterns 

Example  

Content type (input) 

INPUT 

content-type

troff

Content type (output) 

OUTPUT 

content-type

postscript, impress

Printer type 

TERM 

printer-type

att495

Printer name 

PRINTER 

printer-name

lp1

Character pitch 

CPI 

scaled-decimal

10

Line pitch 

LPI 

scaled-decimal

6

Page length 

LENGTH 

scaled-decimal

66

Page width 

WIDTH 

scaled-decimal

80

Pages to print 

PAGES 

page-list

1-5,13-20

Character set 

CHARSET 

character-set

finnish

Form name 

FORM 

form-name

invoice2

Number of copies 

COPIES 

integer

3

Special modes

MODES 

mode

landscape

A print filter definition can include more than one template. Multiple templates are entered on a single line and separated with commas, or they are entered on separate lines, preceded by the Options: prefix.

The format of a template is as follows:

keywordpattern = replacement

The keyword identifies the type of option being registered for a particular characteristic of the filter.

The pattern is a specific option for the keyword.

The replacement is what happens when the keyword has the noted value.

For an example of how an option is defined for a particular filter, suppose you want to have the print service scheduler assign print requests to filters following this criteria:

To specify these criteria, provide the following templates as options to the lpfilter command:


Options: OUTPUT impress=-I, OUTPUT postscript=-P

If the Options line becomes too long, put each template on a separate line, as follows:


Options: OUTPUT impress=-I
Options: OUTPUT postscript=-P 

In both templates, the keyword is defined as OUTPUT. In the first template, the pattern is impress and the value of the replacement is -I. In the second template, the value of pattern is postscript and the value of replacement is -P.

To find out which values to supply for each type of template (that is, for the pattern and replacement arguments for each keyword), consider the following:

The replacement part of a template shows how the value of a template should be given to the filter program. It is typically a literal option, sometimes with the placeholder asterisk (*) included to show where the value goes. The pattern and replacement also can use the regular expression syntax of ed(1) for more complex conversion of user input options into filter options. All regular expression syntax of ed(1) is supported, including the \( ... \) and \n constructions, which can be used to extract portions of the pattern for copying into the replacement, and the &, which can be used to copy the entire pattern into the replacement.


Note -

If a comma or an equal sign (=) is included in a pattern or a replacement, precede it with a backslash (\). A backslash in front of any of these characters is removed when the pattern or replacement is used.


How to Create a New Print Filter

  1. Log in as superuser or lp on the print server.

  2. Create a print filter program.

    See "Writing a Print Filter Program" for information on print filter programs. By convention, filter programs for PostScript printers are located in the /usr/lib/lp/postscript directory. You should put programs you create under /usr/lib/lp in a directory of your choosing.

  3. Create a print filter definition.

    See "Creating a Print Filter Definition" for information on print filter definitions. You should save the printer filter definition in a text file. By convention, filter definitions are located in the /etc/lp/fd directory and are identified with the .fd suffix.

  4. Add the print filter to a print server.

    For instructions, see "How to Add a Print Filter".

Examples--Creating a New Print Filter

The following example shows a print filter definition to convert N37 or Nlp to simple.


Input types: N37, Nlp, simple
Output types: simple
Command: /usr/bin/col
Options: MODES expand = -x
Options: INPUT simple = -p -f

In this example, the print filter program is named col. Once you add the new print filter to a print server, a user's print requests will be handled as follows:


$ lp -y expand report.doc

The print filter program is run with the following arguments to convert the file:


/usr/bin/col -x -p -f

$ lp -T N37 -y expand report.doc

The print filter program is run with the following arguments to convert the file:


/usr/bin/col -x

The following example shows a print filter definition to convert from troff to PostScript.


Input types: troff
 
Output types: postscript
 
Printer types: PS
 
Filter type: slow
 
Command: /usr/lib/lp/postscript/dpost
 
Options: LENGTH * = -l*
 
Options: MODES port = -pp, MODES land = -pl
Options: MODES group \=\([1-9]\) = -n\l

In this example, the filter program is named dpost. It takes one input type, troff, produces a postscript output, and works with any printer of type PS (PostScript). Users need to give just the abbreviation port or land when they ask for the paper orientation to be in portrait mode or landscape mode. Because these options are not intrinsic to the LP print service, users must specify them using the -y option to the lp command.

After you add the new print filter to a print server, print requests will be handled as follows:


$ lp -T troff -o length=60 -y land -d luna ch1.doc

The print filter program dpost is run with the following arguments to convert the file:


/usr/lib/lp/postscript/dpost -l60 -pl luna ch1.doc

$ lp -T troff -y group=4 -d luna ch1.doc

The print filter program dpost is run with the following arguments to convert the file:


/usr/lib/lp/postscript/dpost -n4

Creating a New Printer Form

When you want to provide a new form, you must define its characteristics by entering information about nine required characteristics (such as page length and page width) as input to the lpforms command. The LP print service uses this information to:

The form name can be anything you choose, as long as it does not contain more than 14 alphanumeric characters and underscores. The information must be in the following format:


Page length: scaled number
Page width: scaled number
Number of pages: integer
Line pitch: scaled number
Character pitch: scaled number
Character set choice: character-set-name [,mandatory]
Ribbon color: ribbon-color
Comment:
informal notes about the form
Alignment pattern: [content-type] alignment pattern

The optional phrase [,mandatory] means that the user cannot override the character set choice in the form. The content-type can be given, although this is optional, with an alignment pattern. If this attribute is given, the print service uses it to determine, as necessary, how to filter and print the file.

With two exceptions, the information may appear in any order. The exceptions are the Alignment pattern (which must always be last), and the comment (which must always follow the line with the Comment: prompt). If the comment contains a line beginning with a key phrase (like Page length, Page width, and so on), precede that line with a > character so the key phrase is not at the beginning of the line. The initial > character is stripped from the comment and is not displayed.

Not all of the information must be given. When you do not specify values for the items listed in Table 44-7, the default values are assigned. Before running the lpforms command, gather the following information about the new form:

Table 44-7 Default Form Values

Item 

Default 

Description 

Page length 

66 lines 

The length of the form, or the length of each page in a multipage form. This information can be the number of lines, or the size in inches or centimeters. 

Page width 

80 columns 

The width of the form, in characters, inches, or centimeters. 

Number of pages 

The number of pages in a multipage form. The LP print service uses this number with a print filter (if available) to restrict the alignment pattern to a length of one form. See the description of alignment pattern below. If no filter is available, the LP print service does not truncate the output. 

Line pitch 

6 lines per inch 

A measurement of how close lines appear on the form. This is also called leading. It is the distance between two lines, from baseline to baseline, measured by either lines per inch or lines per centimeter. 

Character pitch 

10 characters per inch 

A measurement of how close together characters appear on the form. It is the distance between characters, measured by either characters per inch or characters per centimeter. 

Character set choice 

Any 

The character set, print wheel, or font cartridge that should be used when this form is used. Users may choose a different character set for their own print requests when using this form, or you can require that only one character set be used. 

Ribbon color 

Any 

If the form should always be printed using a certain color ribbon, the LP print service can give a mount alert message indicating which color to use. 

Comment  

(No default) 

Any remarks that might help users understand the form. For example, the remarks could indicate the name of the form, its revision, its purpose, or restrictions on its use. 

Alignment pattern

(No default) 

A sample file that the LP print service uses to fill one blank form. When mounting the form, you can print this pattern on the form to align it properly. You can also define a content type for this pattern so that the print service knows how to print it. 


Note -

The LP print service does not try to mask sensitive information in the alignment pattern. If you do not want sensitive information printed on sample forms--for example when you align checks--then you should mask the appropriate data. The LP print service keeps the alignment pattern stored in a safe place, where only those logged in as root or lp can read it.


When you have gathered the information for the form, you enter it as input to the lpforms command. You should record this information first in a separate file so you can edit it before entering it with lpforms. You can then use the file as input instead of typing each piece of information separately after a prompt.

How to Create a New Form Definition

  1. Log in as superuser or lp on the print server.

  2. Create a form definition file.

    See "Creating a New Printer Form" for a description on creating print forms. You should save the printer definition in a text file.

  3. Add the form to the LP print service by using the lpadmin command.


    # lpadmin -p printer-name -M -f form-name
    
  4. Add the form to a print server.

    For instructions, see "How to Add a Form".

Chapter 45 LP Print Service Reference Information

This chapter provides background information on the LP print service.

For step-by-step instructions on print management tasks, see:

The LP Print Service

The LP print service is a set of software utilities that allows users to print files while they continue to work. Originally, the print service was called the LP spooler. (LP stood for line printer, but its meaning now includes many other types of printers, such as laser printers. Spool is an acronym for system peripheral operation off-line.)

The print service consists of the LP print service software, any print filters you may provide, and the hardware (the printer, system, and network connections).

The Structure of the LP Print Service

This section describes the directory structure, files, logs, and commands of the LP print service.

Directories

The files of the LP print service are distributed among seven directories, as shown in Table 45-1.

Table 45-1 Directories for the LP Print Service

Directory 

Contents 

/usr/bin

The LP print service user commands 

/etc/lp

A hierarchy of LP server configuration files 

/usr/share/lib

The terminfo database directory

/usr/sbin

The LP print service administrative commands 

/usr/lib/lp

The LP daemons; directories for binary files and PostScript filters; and the model directory (which contains the standard printer interface program)

/var/lp/logs

The logs for LP activities: lpsched.n - Messages from lpsched and requests.n - Information about completed print requests

/var/spool/lp

The spooling directory where files are queued for printing 

Configuration Files

The scheduler stores configuration information in LP configuration files located in the /etc/lp directory, as described in Table 45-2.


Caution - Caution -

The configuration files listed in Table 45-2 are private interfaces, and are subject to change in future releases. You should not build software that relies on these files being in their current locations or that relies on the data being in the format currently used.


Table 45-2 Contents of the /etc/lp Directory

File 

Type 

Description 

classes

Directory 

Files identifying classes provided by the lpadmin -c command.

fd

Directory 

Description of existing filters. 

filter.table

File 

Print filter lookup table. 

forms

Directory 

Location to put files for each form. Initially, this directory is empty. 

interfaces

Directory 

Printer interface program files. 

logs

Link to /var/lp/logs

Log files of printing activities. 

model

Link to /usr/lib/lp/model

The standard printer interface program. 

printers

Directory 

Directories for each local printer. Each directory contains configuration information and alert files for an individual printer. 

pwheels

Directory 

Print wheel or cartridge files. 

These configuration files serve a similar function to the /etc/printcap file in SunOS 4.x.


Note -

You can check the contents of the configuration files, but you should not edit them directly. Instead, use the lpadmin(1M) command to make configuration changes. Your changes will be written to the configuration files in the /etc/lp directory. The lpsched daemon administers and updates the configuration files.


The /etc/lp/printers directory has a subdirectory for each local printer known to the system. The following example shows the /etc/lp/printers subdirectories of printers sparc1 and luna.


$ ls -l /etc/lp/printers
drwxrwxr-x 2 lp lp 512 Jan 23 23:53 luna
drwxrwxr-x 2 lp lp 512 Jan 11 17:50 sparc1

Within each of the printer-specific directories, the following files can describe the printer:

The configuration file for the printer luna, /etc/lp/printers/luna/configuration, would typically appear as follows:


Banner: on: Always
Content types: PS
Device: /dev/term/b
Interface: /usr/lib/lp/model/standard
Printer type: PS
Modules: default

The terminfo Database

The /usr/share/lib directory contains the terminfo database directory, which contains definitions for many types of terminals and printers. The LP print service uses information in the terminfo database to initialize a printer, to establish a selected page size, character pitch, line pitch, and character set, as well as to communicate the sequence of codes to a printer.

Each printer is identified in the terminfo database with a short name. See "Printer Type" for a description of the structure of the terminfo database. If necessary, you can add entries to the terminfo database, but it is a tedious and time-consuming process. See "Adding a terminfo Entry for an Unsupported Printer".

Daemons and LP Internal Files

The /usr/lib/lp directory contains daemons and files used by the LP print service, as described in Table 45-3.

Table 45-3 Contents of the /usr/lib/lp Directory

File 

Type 

Description 

bin

Directory 

Contains files for generating printing alerts, slow filters, and queue management programs. 

lpsched

Daemon 

Manages scheduling of LP print requests. 

model

Directory 

Contains the standard printer interface program. 

postscript

Directory 

Contains all PostScript filter programs provided by the SunOS 5.x LP print service. These filters come with descriptor files in the /etc/lp/fd directory that tell the LP print service the characteristics of the filters and where to locate them.

Log Files

The LP print service maintains two sets of log files:

Print Queue Logs

The scheduler for each system keeps a log of print requests in the directories /var/spool/lp/tmp/system and /var/spool/lp/requests/system. Each print request has two files (one in each directory) that contain information about the request. The information in the /var/spool/lp/requests/system directory can be accessed only by root or lp. The information in the /var/spool/lp/tmp/system can be accessed only by the user who submitted the request, root, or lp.

The following example shows the contents of the /var/spool/lp/tmp/terra directory:


$ ls /var/spool/lp/tmp/terra
20-0 21-0
terra$ cat 21-0
C 1
D slw2
F /etc/default/login
P 20
t simple
U tamiro
s 0x1000

These files remain in their directories only as long as the print request is in the queue. Once the request is finished, the information in the files is combined and appended to the file /var/lp/logs/requests, which is described in the next section.

Use the information in the /var/spool/lp logs if you need to track the status of a print request that is currently in the queue.

History Logs

The LP print service records a history of printing services in two log files: lpsched and requests. These log files are located in the /var/lp/logs directory. You can use the information in these logs to diagnose and troubleshoot printing problems. This is an example of the contents of the /var/lp/logs directory:


# cd /var/lp/logs
# ls
lpsched.1    requests    requests.2
lpsched     lpsched.2    requests.1
# 

The files with the .1 and .2 suffixes are copies of the previous day's logs. Each day, the lp cron job cleans out the lpsched and requests log files and keeps copies for two days. See "Creating and Editing crontab Files" in Chapter 59, Scheduling System Events (Tasks) , for suggestions on modifying the cron job for cleaning out the requests log.

The two most important log files for troubleshooting is the lpsched log, which contains information about local printing requests

The requests log contains information about print requests that are completed and no longer in the print queue. Once a request is finished printing, the information in the /var/spool/lp log files is combined and appended to the /var/lp/logs/requests log.

The requests log has a simple structure, so that you can extract data using common UNIX shell commands. Requests are listed in the order they are printed, and are separated by lines showing their request IDs. Each line below the separator line is marked with a single letter that identifies the kind of information contained in that line. Each letter is separated from the data by a single space.

The following example shows the contents of a requests log:


# pwd
/var/lp/logs
# tail requests.2
= slw2-20, uid 200, gid 200, size 5123, Tue Jun 17 10:16:10 MDT
1997
z slw2
C 1
D slw2
F /etc/motd
P 20
t simple
U irving
s 0x0100
#

Table 45-4 shows the letter codes and the content of their corresponding lines in the LP requests log.

Table 45-4 Letter Codes in the LP requests Log

Letter 

Content of Line 

=

The separator line. It contains the following items: request ID, user ID (UID), and group IDs (GIDs) of the user, the total number of bytes in the original (unfiltered) file size, and the time when the request was queued. 

C

The number of copies printed. 

D

The printer or class destination or the word any.

F

The name of the file printed. The line is repeated for each file printed; files were printed in the order shown. 

f

The name of the form used. 

H

One of three types of special handling: resume, hold, and immediate.  

N

The type of alert used when the print request was successfully completed. The type is the letter M if the user was notified by email or W if the user was notified by a message to the terminal.

O

The printer-dependent -o options (for example, nobanner).

P

The priority of the print request. 

p

The list of pages printed. 

r

A single-letter line that is included if the user asked for "raw" processing of the files (the -r option of the lp command).

S

The character set, print wheel, or cartridge used. 

s

The outcome of the request, shown as a combination of individual bits expressed in hexadecimal form. Several bits are used internally by the print service. The bits and what they mean are describe in Table 45-5.

T

The title placed on the banner page. 

t

The type of content found in the files. 

U

The name of the user who submitted the print request. 

x

The slow filter used for the print request. 

Y

The list of special modes for the print filters used to print the request. 

z

The printer used for the request. This printer differs from the destination (the D line) if the request was queued for any printer or a class of printers, or if the request was moved to another destination.

Table 45-5 shows the outcome codes in the LP requests log and their descriptions.

Table 45-5 Outcome Codes in the LP requests Log

Outcome Code 

Description 

0x0001

The request was held pending resume. 

0x0002

Slow filtering is running. 

0x0004

Slow filtering finished successfully. 

0x0008

The request is on the printer. 

0x0010

Printing finished successfully. 

0x0020

The request was held pending user change. 

0x0040

The request was canceled. 

0x0080

The request will print next. 

0x0100

The request failed filtering or printing. 

0x0200

The request is in transit to a remote printer. (obsolete) 

0x0400

The user will be notified. 

0x0800

A notification is running. 

0x1000

A remote system has accepted the request. (obsolete) 

0x2000

The administrator placed a hold on the request. 

0x4000

The printer had to change filters. 

0x8000

The request is temporarily stopped. 

Spooling Directories

Files queued for printing are stored in the /var/spool/lp directory until they are printed, which may be only seconds. Table 45-6 shows the contents of the /var/spool/lp directory.

Table 45-6 Contents of the /var/spool/lp Directory

File 

Type 

Description 

SCHEDLOCK

File 

Lock file for the scheduler. Check for this file if the scheduler dies and will not restart. 

admins

Directory 

Link to /etc/lp.

bin

Directory 

Link to /usr/lib/lp/bin.

logs

Link 

Link to ../lp/logs where completed print requests are logged.

model

Link 

Link to /usr/lib/lp/model.

requests

Directory 

Directory that contains subdirectories for each configured printer where print requests are logged until printed. Users cannot access this log. 

system

Directory 

A print status file for the system. 

temp

Link 

Link to /var/spool/lp/tmp/hostname, which contains the spooled requests.

tmp

Directory 

Directory for each configured printer where print requests are logged until printed. Changes to existing print requests are also recorded in this log. 

LP Print Service Commands

Table 45-7 lists frequently used LP print service commands. You must be root or lp to use the 1M commands.

Table 45-7 Quick Reference to LP Print Service Commands

Command 

Task 

enable(1) 

Activate a printer 

cancel(1) 

Cancel a print request 

lp(1) 

Send one or more file(s) to a printer 

lpstat(1) 

Report the status of the LP print service 

disable(1) 

Deactivate one or more printers 

accept(1M) 

Permit print requests to be queued for a specific destination 

reject(1M)

Prevent print requests from being queued for a specific destination 

lpadmin(1M) 

Set up or change printer configuration 

lpfilter(1M) 

Set up or change filter definitions 

lpforms(1M) 

Set up or change preprinted forms  

lpadmin(1M) 

Mount a form 

lpmove(1M)

Move output requests from one destination to another 

lpsched(1M) 

Start the LP print service scheduler 

lpshut(1M) 

Stop the LP print service scheduler 

lpusers(1M) 

Set or change the default priority and priority limits that can be requested by users of the LP print service 

Functions of the LP Print Service

The LP print service performs the following functions:

"The Structure of the LP Print Service" describes the directory structure and commands.

How LP Administers Files and Schedules Local Print Requests

The LP print service has a scheduler daemon called lpsched. The scheduler daemon updates the LP system files with information about printer setup and configuration.

The lpsched daemon schedules all local print requests on a print server, as shown in Figure 45-1, whether users issue the requests from an application or from the command line. Also, the scheduler tracks the status of printers and filters on the print server. When a printer finishes a request, the scheduler schedules the next request, if there is one, in the queue on the print server.

Figure 45-1 The lpsched Daemon Schedules Local Print Requests

Graphic

Each print server must have only one LP scheduler running. The scheduler is started when a system is booted (or enters run level 2) by the control script /etc/rc2.d/S80lp. Without rebooting the systems, you can stop the scheduler with the /usr/lib/lp/lpshut command and restart the scheduler with the lpsched command. The scheduler for each system manages requests issued to the system by the lp commands.

Scheduling Network Print Requests

Each print client communicates directly with a print sever over the network. The communication is done between the requesting command (lp, lpstat, cancel, lpr, lpq, or lprm) and the print service on the print server. Doing so, reduces the print system overhead on client only systems, improving scalability, performance and accuracy of data.

Print servers now listen for print request with the Internet services daemon (inetd). Upon hearing a request for print service from the network, inetd starts a program called the "protocol adaptor" (in.lpd). The protocol adaptor translates the print request and communicates it to the print spooler, returning the results to the requestor. It starts on demand and exits when it has serviced the network request. This eliminates idle system overhead for printing. It also eliminates any additional system configuration for networked printing support as was the case in previous versions of Solaris printing.

Filtering Print Files

Print filters are programs on the print server that convert the content of a queued file from one format to another.

A print filter can be as simple or as complex as needed. SunOS 5.x system software provides print filters in the /usr/lib/lp/postscript directory that cover most situations where the destination printer requires the data to be in PostScript format. If you need filters for non-PostScript printers, you have to create the filters and add them to the systems that need them.

A set of print filter descriptor files are provided in the /etc/lp/fd directory. These descriptor files describe the characteristics of the filter (for example, fast or slow filter), and point to the filter program (for example, /usr/lib/lp/postscript/postdaisy).

What the Printer Interface Program Does

The LP print service interacts with other parts of the operating system. It uses a standard printer interface program to:

The LP print service uses the standard interface program (found in the /usr/lib/lp/model directory) unless you specify a different one. You can create custom interface programs, but you must make sure that the custom program does not terminate the connection to the printer or interfere with proper printer initialization.

How the lpsched Daemon Tracks the Status of Print Requests

The lpsched daemon on both the print server and print client keeps a log of each print request that it processes and notes any errors that occur during the printing process. This log is kept in the /var/lp/logs/lpsched file. Every night, the lp cron job renames /var/lp/logs/lpsched to a new lpsched.n file and starts a new log file. If errors occur or jobs disappear from the print queue, you can use the log files to determine what lpsched has done with a printing job.

Cleaning Out Log Files

The lpsched and requests log files in the /var/lp/logs directory grow as information is appended. The LP print service uses a default cron job to clean out the log files. The lp cron job is located in the /var/spool/cron/crontabs/lp file. It periodically moves the contents of the log files. The contents of log are moved to log.1, and the contents of log.1 are moved to log.2. The contents of log.2 are lost (that is, replaced by the former contents of log.1) when log.2 gets overwritten.


# pwd
/var/lp/logs
# tail requests
s 0x1010
= slw2-20, uid 200, gid 200, size 5123, Mon Jun 16 12:27:33 MDT
1997
z slw2
C 1
D slw2
F /etc/motd
P 20
t simple
U irving
s 0x1010
#

How to Change Frequency of Printer Request Log Rotation

Starting with the Solaris 2.6 release, the requests log file on the printer server is rotated weekly rather than daily. You may want to change the rotation interval back to daily if the printer server is busy.

  1. Become superuser or lp on the printer server.

  2. Set the EDITOR environment variable.


    # EDITOR=vi
    # export EDITOR
    
  3. Edit the lp crontab file.


    # crontab -e lp
    
  4. Change the first line of the file which rotates the requests log files every Sunday (0) to an asterisk (*) for daily rotation:


    13 3 * * * cd /var/lp/logs; if [ -f requests ]; then if
    [ -f requests.1 ]; then /bin/mv requests.1 requests.2; fi; /usr/bin/cp 
    requests requests.1; >requests; fi
  5. Save the file and exit.

How Local Printing Works

Figure 45-2 shows what happens when a user submits a request to print a PostScript file on a local printer, which is a printer connected to the user's system. The local system does all processing; however, the print request follows the same path it would if the client and server were separate systems. Requests always flow from client to server following the same path.

Figure 45-2 The Local Printing Process

Graphic

How Remote Printing Works

Figure 45-3 shows what happens when a user on a SunOS 5.6 print client submits a print request to a SunOS 4.1 print server. The command opens a connection and handles it's own communications with the print server directly.

Figure 45-3 Network Printing Between a SunOS 5.6 Print Client and a SunOS 4.1 Print Server

Graphic

Figure 45-4 shows a SunOS 4.1 print client submitting a print request to a SunOS 5.6 print server. The lpd daemon handles the local part of the print request and the connection to the print server. On the print server, the network listen process, inetd, waits for network printing requests and starts a protocol adaptor to service the request. The protocol adaptor communicates with the lpsched daemon, which processes the request on the print server.

Figure 45-4 Network Printing Between a SunOS 4.1 Print Client and a SunOS 5.6 Print Server

Graphic

Figure 45-5 shows what happens when a user of a SunOS 5.6 print client submits a print request to a SunOS 5.6 print server. The print command on the print client handles the local part of each print request by communicating directly with the print server.

The inetd process on the print server monitors network printing requests and starts a protocol adaptor to communicate with the lpsched daemon on the print server, which processes the print request.

Figure 45-5 Network Printing Between a SunOS 5.6 Print Client and a SunOS 5.6 Print Server

Graphic