IBM Support

System V Printing - Adding a JetDirect Printer: Lab 5

Question & Answer


Question

System V Printing - Adding a JetDirect Printer: Lab 5

Answer

PowerPC) printing to the System V print subsystem. If you have not done this, see AIX System V Printing - Changing to the System V Print System: Lab 0. System V printers can only be added from the command line or from Web-based System Manager. They are not supported from SMIT.

This document only applies to AIX 5L and later when using the System V Print subsystem.

This lab goes through the following steps:

  1. Overview of JetDirect Printing
  2. Adding a local JetDirect printer from the command line
  3. Adding a local JetDirect printer with the script
  4. Adding a local JetDirect printer from WSM
  5. Flag support using the alternate interface script.
  6. Lab summary


Overview of JetDirect printing

JetDirect printing is similar to local printing in several ways (local filtering, alerts, print options, no entry in the Systems file), but quite different in others.

When you submit a print job to a JetDirect-attached printer, the lp command contacts lpsched, which calls a first JetDirect-specific interface program. The first interface program in turn calls the standard interface program and pipes the resulting output to the hpnpf program, which communicates wtih the JetDirect card on the printer.

An alternate interface script is also supplied that adds support for -o formatting flags for laserjet printers.

if any control flags from the lp print command.


Adding a local JetDirect printer from the hpnpcfg script

AIX 5L includes a JetDirect printer configuration script. This section describes how to use /usr/lib/hpnp/hpnpcfg to add JetDirect printers. This is not the supported method of adding printers, but again works quite well.

To use this script with the most flexibility, see the comments in /usr/lib/hpnp/hpnpIS.model.

#  The /usr/lib/hpnp/hpnpcfg utility can be used to add printers using this
#  script, but first the ould script /usr/lib/hpnp/hpnp.model must be
#  overwriten by this script:
#
#      mv /usr/lib/hpnp/hpnp.model /usr/lib/hpnp/hpnp.model.orig
#      cp /usr/lib/hpnp/hpnpIS.model /usr/lib/hpnp/hpnp.model
#  Invoke the hpnpcfg utility and add printer, defaulting the printer-type and
#  context-type:
#      /usr/lib/hpnp/hpnpcfg
--> Follow these steps to add the printer:

  1. Start the script
     # /usr/lib/hpnp/hpnpcfg
            HP NETWORK PRINTER CONFIGURATION TASKS
                           MAIN MENU
            1) Verify installation of software
            2) Configure a printer with BOOTP/TFTP
            3) Verify BOOTP/TFTP configuration
            4) Verify network printer connectivity
            5) Verify network printer operation
            6) Add printer to spooler
            7) Remove printer BOOTP/TFTP configuration
            8) Remove printer from spooler
                 ?) Help            q) Quit
     Please enter selection: 
    
  2. Choose Add printer to spooler by entering 6.
     Please enter selection: 6
    
  3. Enter the printer name to be used from the lp command
     Enter the lp spooler destination name: jet2
    
  4. Enter the ipaddress or hostname of the JetDirect printer
     Enter the network peripheral name (default=jet2): 9.19.26.125
    
  5. Enter a printer type of hplaserjet
     Enter printer type: (default=unknown) hplaserjet
    
  6. Enter simple, pcl, or ps
     Enter context-type for printer (default=simple) Press enter
    
  7. The next prompt is to add this printer to a class. Press enter for this lab.
     Enter the spooler class for the peripheral to join (optional):
    
  8. Answer 'n' or 'y' to the question about default printer.
     Will this be the default printer? (y/n/q default=n) n
     Ready to shut down the spooling system, configure the new destination,
     and start the spooling system again.  When the spooling system is shut
     down all printing will stop.  Any print requests that are currently
     printing will be reprinted in their entirety when the spooling system
     is restarted.
     OK to continue? (y/n/q default=y) y
    
  9. Enter y to continue.
    /usr/sbin/lpadmin -p jet2 -v /dev/null -f allow:all -u allow:all -I pcl -T 
    hplaserjet
    mv /usr/spool/lp/admins/lp/interfaces/jet2 /usr/spool/lp/admins/lp/interfaces/mo
    del.orig/
    jet2
    sed -e s/^PERIPH=/PERIPH=9.19.26.125/ /usr/lib/hpnp/hpnp.model 
    > /usr/spool/lp/admins/lp/
    interfaces/jet2
    /usr/sbin/accept jet2
    UX:accept: INFO: destination "jet2" now accepting requests
    /usr/bin/enable jet2
    UX:enable: INFO: printer "jet2" now enabled
    The spooler destination jet2 has been added to the spooler.
    Press the return key to continue ... 
    
  10. Press enter and then q to exit the tool
            HP NETWORK PRINTER CONFIGURATION TASKS
                           MAIN MENU
            1) Verify installation of software
            2) Configure a printer with BOOTP/TFTP
            3) Verify BOOTP/TFTP configuration
            4) Verify network printer connectivity
            5) Verify network printer operation
            6) Add printer to spooler
            7) Remove printer BOOTP/TFTP configuration
            8) Remove printer from spooler
                 ?) Help            q) Quit
    Please enter selection: q
    
    
  11. Test printer
    # lpstat -p
    printer jet1 is idle. enabled since Wed Apr 17 12:45:46 2002. available.
    printer jet2 is idle. enabled since Wed Apr 17 13:30:22 2002. available.
    # lp -d jet2 /etc/motd
    


Adding a local JetDirect printer from WSM

Although SMIT does not support adding System V printers, the Web-based System Manager tool can be used for this purpose. This section describes adding a System V printer with WSM.

  1. Start Web-based System Manager GUI. This requires that you are running from a graphical desktop such as CDE. To start type wsm.

  2. Click the Printers (System V) icon.

  3. Click the Standard Overview and Tasks icon. This will bring up the Directory Disabled Printers (System V) This says Directory Disabled, because they are not yet supported by LDAP. In this window you will see the TASKS menu which contains:
    • New Printer
    • Set Default Printer
    • Remove Printer
    • Switch to PowerPC print subsystem
    The following status information is also displayed.
    • Default printer:
    • Requests on default:
    • Printers defined:
    • Printers stopped:

  4. Click the text that reads New Printer. This starts a set of wizard panels that guide you through adding the printer. The first screen is titled Add New Printer with a subtitle Step 1 of 4: Specify New Printer and Attachment Method The first paragraph reads:
    This wizard helps you in creating a new System V printer.  You will be
    guided through a series of panels designed to determine the
    parameters required to use your printer.
    
  5. Enter the desired printer name
     What do you want to call the printer? jet4
    
  6. Enter optional information if desired or simply leave blank
     What print clas will the printer handle (optional):
     What description do you want (optional):
    
  7. Click the Attachment Method labeled Remote connection to a network printer from the three choices shown here:
    Attachment Method
      [ ] Local connection to this system
      [ ] Remote connection to local printer on another system
      [x] Remote connection to a network printer
    
  8. Click the Next button at the bottom. This will bring up a window with the subtitle Step 2 of 3: Specify Remote Network Printer Attachment Options with the description,
     Use this panel to specify the system where the network is defined
    
  9. Enter the hostname or ipaddress of the JetDirect printer.
     What is the remote system name?  jethost
    
  10. Click the next button which brings up the window with a submenu of Step 3 of 4: Specify Printer Options and a description
     Use this panel to specify the printer options  
    
  11. Enter the type of alert desired. The default is E-mail, and the choices include E-mail, message, nothing, and run script. If you specify run script, you can enter the full path name of the script to run when there is a printer allert.
      What action is to happen on a printer alert?  E-mail
    
  12. The next choice is what options to take when the job is restarted. The default is Top of page, and the options include Top of page, beginning, and wait.
      How do you want to continue on restart? Top of page
    
  13. The next choice is the print processing model. The default is Standard and this should be used unless you are printing to a PostScript printer. This determines the interface script that will be used.
     What is the print processing model?  Standard
    
  14. The next choice is the printer type. The default is Conon Bubble Jet 10ex. Click the box for a list of the available printers and choose the printer that most closely matches your printer. For most laser printers there is no difference in the actions. This will determine the terminfo TERM type used by the simple interface script. For most laser printers, the actual TERM type will be set to hplaserjet.
      What is the printer type? HP LaserJet 5 (PCL)
    
  15. The final choice on this page is the printer interface. This determines the -I flag used by the lpadmin command when adding the printer, and determines the filter that will be used by lpsched when a job is printed. The default is simple. For text printers select PCL, and for PostScript printers select PS.
     What is the print interface?  PCL
    
  16. Click the Next button to go to the next screen. This screen has a subtitle of Step 4 of 4: Verify Settings and Add New Printer. The screen shows the following information for the values added earlier
    You have specified a network printer with the following settings.
     Printer name:           jet4
     Class:
     Comment:
     Host name:              jethost
     Alert:                  E-mail
     Script path name:
     Restart:                Top of page
     Processing model:       Standard
     Print interface:        PCL
     Printer type:           HP LaserJet 5 (PCL)
    
  17. Click Finish to add the printer.

  18. If you are successful, yet another window will pop up with a message You have successfully created a new printer. Click the OK button to finish, and the two windows will close. The main Printers window on wsm will show the number of Printers defined has increased by one.

  19. From the command line check the printer status and test printing.
    # lpstat -p jet4
    printer jet4 is idle. enabled since Wed Apr 17 14:48:09 2002. available.
    # lp -d jet4 /etc/motd
    request id is jet4-10 (1 file)
    # lpstat -p jet4
    printer jet4 now printing jet4-10. enabled since Wed Apr 17 14:48:09 2002. 
    available.
    # lpstat -p jet4
    printer jet4 is idle. enabled since Wed Apr 17 14:48:09 2002. available.
    


Flag support using the alternate interface script

The standard model script for Jetdirect printing is hpnp.model. This script uses the default model script, and does not provide the ability to specify the paper tray, page size, orientation, or other options like this from the command line. However, a script is available in /usr/lib/hpnp that will add this functionality. The script is called hpnpIS.model.

Probably the easiest way to use the script is to make a backup of the original hpnp.model script and then copy the hpnpIS.model script over the hpnp.model script. If you do this, you will be able to use any of the methods described earlier to add the printer. To make this change follow these steps:

# cd /usr/lib/hpnp
# cp hpnp.model hpnp.model.bak
# cp hpnpIS.model hpnp.model
One problem with this is that future updates may overwrite this file.

Another way to use this script is to specify the model from the command line with the -i flag for the lpadmin command as shown here:

# lpadmin -p jet5 -i /usr/lib/hpnp/hpnpIS.model -v /dev/null \
  -T unknown -I simple
Then change to the /usr/spool/lp/admins/lp/interfaces directory and edit the script to change the line:
PERIPH=
  to
PERIPH=jethost
Where jethost is the hostname of the jetdirect printer.

Next use accept and enable to make the printer ready.

# accept jet5
UX:accept: INFO: destination "jet5" now accepting requests
# enable jet5
UX:enable: INFO: printer "jet5" now enabled
# lpstat -p jet5
printer jet5 is idle. enabled since Wed Apr 17 15:19:09 2002. available.
# lp -d jet5 /etc/motd
This interface script is actually faster, but the more important thing is that you can now use some of the lp -o flags. You can look in the script for details, but some of the -o flags that are supported for PCL include:
 Paper tray:  -o tray1, -o trayu
 Paper size:  -o letter, -o legal, -o ledger, -o A4
 Duplex:      -o d, -o D, -o duplex, -o simplex
 Font:        -o tiny, -o 12
 Raw mode:    -o raw
 Orientation: -o port, -o portrait, -o land -o landscape


Lab summary

During this lab, you learned how to:
  1. Use the lpadmin command to create text and PostScript printers to files
      To print to a real printer change the lpadmin -v command to print to the printer device file in /dev.
  2. Use the lp command to print to the printer
  3. Use the lpstat -p command to list your printers.
  4. Use the lpadmin -x flag to remove printers.
  5. Examine the contents of the file
  6. Set the content type of the input file with the lp -T flag to change the filters that are automatically called.
    • Using -T pcl to add carriage returns to line feeds
    • Using -T PS to keep PostScript files from printing as source

Next try to duplicate the PostScript printer steps with a real printer.

Other System V printing labs

  • System V Printing - Changing to the System V print subsystem: Lab 0
  • System V Printing - Adding a System V Printer From the Command Line: Lab 1
  • System V Printing - System V Filters: Lab 2
  • System V Printing - Interface Scripts: Lab 3



[{"Product":{"code":"SWG10","label":"AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Attached devices","Platform":[{"code":"PF002","label":"AIX"}],"Version":"5.3;6.1;7.1","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
17 June 2018

UID

isg3T1000460