The lp output interface runs the LPP interface script and can be used to generate the basic lp UNIX command for output.
Applications Manager ships with an lp output interface that uses the LPP interface script to handle basic UNIX printing and the LPP.BAT interface script to handle Windows printing. The code from the LPP and LPP.BAT scripts is shown below.
LPP script:
file=$1
shift
eval "lp $* $file"
exit $?
LPP.BAT script:
@echo off
set file=%1
shift
print %1 %2 %3 %4 %5 %6 %file%
The scripts take arguments passed by the Applications Manager output interface object and build the appropriate print command. The first argument passed is the file to be printed, so the scripts move the file name to the end of the command line so it conforms to the syntax of the lp and lpp commands.
Arguments Determined by Output Device Definition
The arguments sent to the LPP interface script originate from the output device definition in Applications Manager. The image below shows the definition for an output device called TEST.
The TEST output device definition.
In the example above, the lp output interface is assigned to the output device. The output interface (as shown below) defines the optional fields Dest, Form, and Queue, as well as basic command design.
The output interface Command line field shows that the LPP interface script runs using the following arguments:
<file>: the output file
<copies>: number of copies
<%USR%>: the requestor name
Build the command line from the information specified in the Output Interfaces window.
The first argument in the command line is always the file name. The command line can include four additional arguments (in addition to the number of copies and a title string). You can specify the format for the arguments in the output interface command.
The first of the four possible arguments is known as the output option. It's specified in the Output Option group box. You can create a drop down, fill-in list box, or free text field. In the image below, the values 'Landscape' and 'Portrait' are part of a drop down list with the value 'Portrait' set as the default value. The output option argument is represented in the command line by the <option text> entry.
Build the command line from the output interface.
The output option allows users to dynamically modify one of the output interface arguments. This feature can eliminate the need to create two output device definitions for each printer in your network, for example one portrait and one landscape. Instead, you can create a single output interface with a portrait/landscape option. An Applications Manager user can select the appropriate option when they select the output device.
Notice that the three arguments shown in the Static options group box in the image above are named Dest, Form, and Queue, and that the flags for each appear in the output interface Command line shown at the bottom of the window.
Specifying the Arguments for the lp Output Interface
The (partial) syntax for the UNIX lp command is as follows:
lp -d dest -f form_name -q queue -n copies -t title
The prep values used by each argument and value are listed in the table below.
This argument and value: | Uses this prep value: |
---|---|
-d <dest> |
#-d# |
-f <form-name> |
#-f# |
-q <queue> |
#-q# |
-n <copies> |
#-n# |
-t <title> |
#-t# |
To minimize the work that has to be done by the LPP interface script, the arguments specified in the output interface definition should closely match the syntax of the lp command.
Notice that each argument in the output interface requires a flag in its Format field, (in Windows, referred to as a switch). After each flag is an optional string or value appropriate to the argument. Include spaces by inserting the designated Space character field (# in these examples). For the lp command, each flag begins and ends with a space.