System Administration Guide
Chapter 4, Managing printers and print jobs

Setting up a printer with multiple names

Setting up a printer with multiple names

The print service allows you to set up a single printer with multiple names to perform multiple functions. For example, if your printer supports both portrait and landscape modes, you can set up a different name for each function and then send jobs to each printer name. These multiple printers are called ``virtual printers''. 

The print spooler system differentiates printers by name only, not by the device to which the printer is connected. To specify different names for the same device and prevent multiple print jobs from appearing simultaneously, you must set up both the real printer and additional virtual printers. The real printer performs the actual printing and the virtual printers pass print jobs to the real printer.

For example, to set up two virtual printers, port and land, that use the capabilities of an Hewlett-Packard LaserJet, use this procedure:

  1. Set up the real printer. See ``Adding local printers''. Specify the ``Name'' as real and set the ``Model'' to HPLaserJet.

  2. Set up the port and land virtual printers. Set the ``Model'' to network. Specify the same ``Device'' to which real is connected.

  3. Create the file /usr/spool/lp/remote and add the following lines:
       port:	lp -dreal -oportrait
       land:	lp -dreal -olandscape
    
    This specifies that when printing to printer land, the print system sends the print job to printer real using the -olandscape option (to print in landscape mode) and when printing to printer port, the print system sends the print job to printer real using the -oportrait option (to print in portrait mode)


    NOTE: The options listed after -dreal depend on the printer model. Check the interface script in /usr/spool/lp/admins/lp/interface for your printer to determine the printer- or class-dependent -o options.

To print a file in landscape mode, enter:

lp -dland filename

This procedure translates the -dland option to lp to the necessary options for the printer (in this example, -dreal -ol).

Another way to accomplish this is to create a simple shell script to perform the type of printing. For example:

   :
   # Land - shell script to print in landscape mode
   # 
   # syntax:  land <file> <file> ...
   #
   # 
   lp -dreal -ol $@

The reasons for choosing one method over the other depend on how your applications access the print system. Many applications allow you to specify only the name of the printer, so virtual printers are the only solution. Other applications might allow complete control over the commands that submit the print job. In this case, you might use the shell script above.

See also: