Next Previous Contents

4. Options and Arguments

The ifhp filter is designed to work with the LPRng print spooler and expects to be passed the standard set of filter options. These have the form:

/.../ifhp [-c] [-X option]* accountingfile
Example:
/.../ifhp -n root -h localhost -P printer -s statusfile acct
# - X is any letter except T

All of the option letters except T are reserved by the LPRng program to pass information to the filter. For details about the options, please consult the LPRng documentation.

4.1 Command Line Options

The most important options that LPRng passes and that uses are:

-s statusfile

The file where ifhp status information is placed.

-Z useroptions

The lpr -Z options passed by the user, and are discussed in the options section.

-T options

These are usually options specified in the printcap entry and are discussed in the options section.

accountingfile

The file where accounting information is written.

Examples: ifhp "-Tmodel=ps,status@" "-Za4,landscape"

Since commas are used to separate options, whitespace is used to separate multiple values for a particular option. You will need to quote this on a command line. For example:

ifhp "-Tfont=elite greek1 dingbat"

The ifhp program first checks to see if the PRINTCAP environment variable is defined. By convention, LPRng will place the printer printcap entry in this variable when it starts the ifhp filter. The printcap :ifhp=options value is extracted and used as the default -T options. After getting the options from the printcap, the -Toptions command line options are appended to the list of -T options. The single letter command line options are also made available to the ifhp programs as shown below:

PRINTCAP=lp:ifhp=model=this,status@:...

ifhp -n root -h localhost -Tmodel=that,debug=1

Concatenated -T options:  model=this,status@,n=root,h=localhost,model=that,debug=1
Resulting    -T options:  status@,n=root,h=localhost,model=that,debug=1

The -T option list is scanned from left to right, and later option values override earlier ones. The -T option values have priority over values that are obtained from the configuration file and cannot be overridden. There are several options that have important effects on the operation of the ifhp filter.

4.2 General Configuration Options - config, model, trace, debug

These options are used to control the global operation of the ifhp filter, and are only available from the -T command line options.

config=pathname

The config option specifies the location of the ifhp.conf file. This overrides the default location. The pathname can be a file name, list of filenames separated by spaces, or a filter. For example:

ifhp '-Tconfig=/etc/ifhp.conf /usr/local/etc/ifhp.conf'
ifhp '-Tconfig=|/usr/local/bin/getconfig'

This will cause the getconfig program to be run and the configuration information read from the program's STDOUT. This facility is strongly deprecated and may not be supported in future releases.

model=MODEL

The model option selects the portion of the ifhp configuration that will set values of configuration parameters. This is discussed in detail in the next section.

trace

As ifhp processes the print job, it produces tracing and error message information. By default this is written to the status file specified by the -s command line option. The trace option will cause this information to be written to STDERR (file descriptor 2). This is usually used in debugging.

debug=n

This option sets the debugging level to n, where n is an integer number. Level 0 turns debugging off, level 1 produces a small amount of verbosity and increasing levels produce more verbose information.

4.3 Status Messages - statusfile, statusfile_max, statusfile_min, summaryfile

statusfile=pathname or -s pathname

The status file pathname is set by the command line -s pathname or if it is not present then the statusfile=pathname configuration option. The file must exist and will not be created.

statusfile_max=n

If the status file is larger than statusfile_max K bytes (default 8K), then it is truncated to statusfile_min=min K bytes.

statusfile_min=n

The minimum size in Kbytes of the status file after truncation (default 1K).

4.4 Printer Status Available - status

The status option indicates that there is a bidirectional connection to the printer, and that status can be obtained from the connection. During initialization the ifhp filter will test the printer connection and determine if it supports reading. If it does not then ifhp will set status@.

4.5 Monitoring Options - sync, waitend, pagecount

The sync, waitend, and pagecount options are ignored if no status is available from the printer. The sync option specifies the method to use to determine if the printer is ready and operational. The waitend option specifies the method used to determine when a print job is finished. The pagecount option specifies the method used to obtain pagecount or status information.

sync@, waitend@, pagecount@

This form of the tag indicates that the particular facility is disabled.

sync=pjl

PJL is used to determine if the printer is ready. This can be done by sending a PJL JOB or PJL ECHO command to the printer and waiting for return status.

sync=ps

A small PostScript job which causes a status report to be returned is sent to the printer.

waitend=pjl, waitend=ps

This is similar to the sync operation, but is done at the end of a job in order to determine if the printer is busy.

pagecount=pjl

Many PJL capable printers support reporting total page usage by means of PJL. This option causes a PJL command to be sent requesting the total page usage by the printer.

pagecount=ps

A small PostScript job which causes a status report to be returned is sent to the printer.

4.6 User -Z Option Support

The ifhp filter provides a simple way for users to request a particular printer facility or option. The lpr -Zkey=value command causes the lpd print spooler to pass the -Z options on the ifhp command line.

The ifhp filter implements these options by first determining if they are allowed, and then using them to select a set of strings that are sent to the printer. Since some options are implement by sending PJL strings to the printer, some by PostScript, and some by PCL commands, the method of specifying and generating them is a bit involved.

The following facility is used to control the names and types of user options.

pjl_user_opts=[ ... ]

This tag specifies the list of user options that are implemented by sending PJL strings to the printer. This is available only if the printer is PJL capable.

pcl_user_opts=[ ... ]

This tag specifies the list of user options that are implemented by sending PCL strings to the printer. This is available only if the printer is PCL capable.

ps_user_opts=[ ... ]

This tag specifies the list of user options that are implemented by sending PostScript strings to the printer. This is available only if the printer is PostScript capable.

For each option, the actual string or set of strings is specified as follows.

pjl_key= ...

The value of the PJL user option key. This value can be one or more lines; the lines are checked for correct PJL format and sent to the printer before any language specific information.

ps_key= ...

The value of the PostScript user option key. This value can be one or more lines; leading and trailing whitespace is removed and the lines are placed before the first lines of a PostScript job file.

pcl_key= ...

The value of the PCL user option key. This value can be one or more lines; whitespace and new lines are removed and the characters are placed before the first characters of a PCL job file.

The following user options are predefined in the default ifhp.conf file and are recommended for use.

a3, a4, a5

Use a3, a4, or a5 paper

copies=N

Print N copies of a page or job

duplex

Use duplex printing, tumble on. Pages will come out so that the margins are at opposite ends of a page.

duplexshort

Use duplex printing, tumble off. Pages will come out so that the margins are at the same ends of a page.

envelope

Select envelope media

inlower

Select media from lower input bin.

inupper

Select media from upper input bin.

landscape

Use Landscape orientation

lduplex

Alias for duplex

ledger

Select ledger size (11x15 inches) media

legal

Select legal size (8.5x15 inches) media

letter

Select letters size (8.5x11 inches) media

manual

Select media from manual feed

mediaselect=N

Select media number N

outlower

Put output in lower tray or bin

outupper

Put output in upper tray or bin

oversize

Select oversize media

portrait

Use Portrait orientation

sduplex

Alias for simplex. Print on the single side of the media.

simplex

Print on the single side of the media.

transparency

Select transparency media

4.7 Adding User Options

The following shows how to add a PJL option to an ifhp.conf file. By convention, the configuration is added to the end of the ifhp.conf file.

[ newprinter ]
pjl_user_opts += [ screen ]
pjl_screen = PJL SCREEN = ON

ps_user_opts += [ fuzzy ]
ps_fuzzy = <</Fuzzy (\%s{fuzzy})>> setpagedevice

In the first example we define the screen option. The lpr -Zscreen option will cause the PJL command PJL SCREEN = ON to be put into the output to the printer.

Similarly, the lpr -Zfuzzy=5 option will cause the PostScript command <</Fuzzy (\%s{fuzzy})>> setpagedevice to be sent to the printer.

4.8 Initialization and Setup Control

Several options are used during the processing steps discussed in Filter Operation Details to control what setup is done for the printer.

pjl_init = [ ... ]

If PJL is enabled on this printer, options in this list are expanded and the resulting values are sent to the printer. After this, the -Z options are expanded and any options which are listed in the pjl_user_opts are processed.

ps_init = [ ... ]

If PostScript is enabled on this printer and a PostScript file is being processed, then the options in this list are expanded and the resulting values are sent to the printer. After this, the -Z options are expanded and any options which are listed in the ps_user_opts are processed.

pcl_init = [ ... ]

If PCL is enabled on this printer and a PCL file is being processed, then the options in this list are expanded and the resulting values are sent to the printer. After this, the -Z options are expanded and any options which are listed in the pcl_user_opts are processed.

These initialization options are very useful in order to set up information controlling the default format or options for a print job. For example:

pcl_init = [ normalpage ]
pcl_normalpage=[ letter crlf linewrap
  portrait clearmargins fixed pitch=10 courier ]

When processing a PCL job, normalpage is expanded by searching first for normalpage and then for pcl_normalpage; this in turn results in the expansion of the list of values. For example, pcl_crlf is usually defined as pcl_crlf=\033&k2G, which is the PCL command to translate a New Line (\015) character as a Carriage Return/New Line. The other entries have similar definitions that produce the desired effects.


Next Previous Contents