README for IFHP
Patrick Powell <firstname.lastname@example.org>
Sun Oct 29 06:25:05 PST 1995
This code has been derived from the CTI Laser Jet filter set;
a modified version of the original README is attached below.
The distribution name and executables have been renamed in order
to ease problems with installation and management.
1. The following executables are available:
ifhp,ofhp - IF and OF filter
banner.sh - PCL banner printer (GNU AWK)
- ofhp is symbolic link to or copy of the ifhp filter
- if ifhp invoked as ofhp or with -Fo option, acts as OF filter
- 'ofhp -Tbanner' will print banners using banner.sh
2. The if filter will check the job files for printability and/or
postscript format. If it is PostScript, it will set the printer
to PostScript mode using the PCL commands, otherwise it will
set the printer to PCL. If you do not want this to happen,
then print the job as a binary file; this suppresses the checks.
Some LPR spoolers use the 'v' format to indicate a binary file;
If this is the case you will need to use the following printcap:
If your LPD server does not allow options in the filter spec,
use the following entry and the following shell script:
/usr/local/lib/filters/ifhp -c $*
2. ifhp takes the full range of LPD filter options, and uses or
or ignores them as applicable. The following command line options
-c - cleartext - dump this directly to the printer, no fonts,
no nothing done. For those desperate people trying to
find a way to print those obnoxious files
-sstatusfile - the name of a status file that is updated with
'rolling status' - i.e. - the last few log messages.
-nuser, -hhost, -Jjob - used by ofhp for banner printing defaults
-T[filteroptions,]* - filter options
autodetect=(yes|no*) printer has autodetect to determine
job type, PCL or POSTSCRIPT
** AUTODETECT environment variable overrides
banner[=off] when in OF mode generates a banner using information
supplied on the 'sb' (short banner) line sent
by the LPR server to the of filter.
When banner is off, the input is simply passed to
the output device and no banner page generation
cartridge=[*yes|no] postscript cartridge present.
If a postscript job detected and no cartridge
prints a message and discards job.
** CARTRIDGE environment variable overrides
debug=debuglevel set the debug level
dev=outdevice /iodevice - an io device, opened RW
- a TCP/IP stream connection
to port on host from (optional) orig_port
default font directory
model=(III|IIID|IIISi|IV*) HP model (default IV)
** MODEL environment variable overrides
plp=[yes|no*] return errorcodes compatible with PLP
default is LPRng errorcodes.
resourcesave=(yes|no*) keep track of fonts
from previous job, and do not download if
font was last downloaded. WARNING: if
multiple spoolers use printer this will not
** RESOURCESAVE environment variable overrides
retries=nn (0*) retry connection or printing count; 0 is infinite
** RETRIES environment variable overrides
sleep=nn (30*) sleep between retries; 0 is no sleep
** SLEEPTIME environment variable overrides
stty=sttycommands a set of stty commands applied when the
iodevice is a serial line.
status=(on|off) get printer status/linenumber information
trace=(on|off*) dump output to a trace file
** TRACE environment variable overrides
wrap=(on|off*) wrap long ouptput lines
** WRAP environment variable overrides
example: hpif '-Tdevice=/dev/ttya,stty=-echo pass8 39200'
Note: you may have multiple -T options.
The -T dev and stty parameters are useful when using the filter with
SUN LPR systems. You may need need a shim filter, i.e. - small shellscript
to set the values:
/usr/local/lib/filters/ofhp `-Tstty=-echo pass8 39200' $*
See the man page for option details.
3. The ifhp filter has the ability to download fonts to the printer.
The font depends on the host originating a job. The mapping is
controlled by the FONTDIR/host_fonts file, which has lines of the form:
See font/host_fonts.proto for details and examples.
The -Tfontdir=directory can be used to set the FONTDIR value,
which defaults to the FONTDIR variable in the Makefile.
The default is /usr/local/lib/filters/font.
4. Printer problems are reported using syslog(3)-
syslog( LOG_WARNING|LOG_LPR, msg);
consult the syslogd(8) man page for details of logging. The parameters
to syslog have been bombproofed and strings are less 80 bytes long.
The accounting procedures may appear rather strange to somebody who does
not come from an Academic environment where avoiding printer accounting
has long been a tradition. The following methods are used.
1. At the start of a job the page counter value is read from the
printer. Since this value is electromechanical, it is VERY difficult
to modify it through software :-)
The value is printed to the accounting file using a line of the form:
start -hhost -uuser -pcountervalue -Pprinter; see src/doaccnt.c
2. At the end of a job the counter is read again, and the usage calculted;
the following line is written to the accounting file:
end -bpages -hhost -uuser -pcountervalue -Pprinter
3. In addition, if the ACCNTSH value is not NULL and the file exists,
then the accounting shell script is invoked with a command line
of the form
ACCNT -bpages -hhost -uuser -pcountervalue -Pprinter [accntfile]
This may appear to be overkill, but it is not. Believe me, it is not.
Read the README.ACCOUNTING for details.
6. The original CTI filter code has been used extensively. See the
Copyright file for a list of the copyrights.
README from the CTI-Print 1.2 Distribution (Edited for consistency with
current version of this software)
The PLP-lpd-filters provided in this package have been developed as part of the
CTI-Print project at the Division of Computing Facilities of the Computer
Technology Institute (CTI), Patras, Greece. The main objective of the project
was to develop a mechanism to serve any kind of printing requests (ascii, PCL
and PostScript jobs) from different network/OS environments supporting
configurable downloading of fonts (in the case of ascii jobs) depending on the
source of the request (i.e. in order to print jobs containing Greek characters
such as the ISO 8859/7, DEC Greek etc).
The PLP-lpd-filters v1.0 are filters for HP LaserJet printers of the III and
4 series. They have been developed to work as part of the lpd platform
implemented by the PLP software (Portable Line Printer Spooler, release
3.4.12 - Patrick Powell, San Diego State University, email@example.com,
1988 - Justin Mason, firstname.lastname@example.org, 1994). However some patches to PLP
v3.4.12 are required so that additional info is passed to the filters as
(1) Interface of PLP-lpd-filters with the PLP lpd daemon
* The filters provide the interface between the PLP-lpd daemon and the
printer and are to be configured in the printcap file in order to be executed
by the lpd daemon every time a printing request is sent to the printer.
* There are two filters for each printer series; one for the banner page
printing and another for the main printing job.
* The filters are assigned to the :bp: and :if: printcap capabilities and, when
executed, are passed as arguments from the lpd all the necessary info
required for their functionality.
- For the III series printers.
Printers of this series do not support bidirectional communication; therefore
counting is attempted by the filters software and not by the printer itself
as the III series printers cannot return any status. For simple ascii files
it's easy to implement accounting by counting chars and lines but not for
PCL and PostScript files.
- For the 4 series printers: full accounting is provided for ascii, PCL and
PostScript printing jobs (as all models of series 4 support status readback
commands, which can report directly from the printer the pages actually
* Printing in duplex mode:
The filters can satisfy direct duplex printing requests (as long as the
printer model supports that and the optional duplex unit is attached) for
Ascii, PCL and PostScript files. This is achieved when invoking lpr by
passing the "duplex" argument with the -Z flag.
* Printing in landscape mode:
This is achieved in the same way as in the
duplex case when invoking lpr by passing the "landscape" argument with the
* Line wrapping:
By setting an env variable in the configuration files the filter can set
the printer to print with line wrapping.
* Font downloading for ascii files from a font pool:
- The font to be downloaded for ascii files is specified per remote host in a
configuration file. This provides the System Administrator with the
capability to configure the printer with special character fonts such as for
various national languages (Greek in the CTI's case).
- The filters of the :if: capability send a file to
the printer. They check the file beforehand and decide if it is a simple
ascii, a PCL or a PostScript file. In the first case it downloads the
appropriate font from the font pool mentioned above.
If the file to be printed is in PCL the filter switches the printer
to PCL mode and then sends the file to be printed. For the Postscript case
the printer acts similarly except that, for series III, it first checks if
the PostScript language is configured to the printer.
- In the original CTI filters, fonts were not downloaded every time a job
was submitted. Unfortunately there are two drawbacks here.
The first is that this cannot work if a printer is controlled by more than
one printer servers. This is because each of the servers can remember the
font which was downloaded by itself and not by the others. Unless an
interaction among the servers takes place some of them might be fooled
about the font actually downloaded last to the printer.
The second issue is that the LaserJet Series 4 printers need to have the
Resource Saving option enabled in order to be able to keep a downloaded
font during personality changes. This has turned out to be difficult
to do. Thus, fonts are downloaded each time we have a job.
(4) Support of specific HP printer models
* For series III the filters work for all models III, IIID and IIISi with the
restrictions mentioned above when mentioning the supported printer features.
You must use -Tstatus=off with these printers as they do not support
* In series 4 for the printer job level control the PJL (Printer Job Language)
is fully utilised. Actually the principles described in Chapter 9, Programming
Tips for Using PJL, of the Printer Job Language Technical Reference Manual
(HP 5961-0603, First Edition - July 1993) have considerably been taken into
* code for HP5 printers has been added, and appears to work satisfactorily.
(5) Principles of Operation
The filter will start by sending synchronization and initialization code
to the printer. Unless suppressed by -Tstatus=off, the filter will
try to read the current status of the printer, and then get the current
page count value unless suppressed by -Tpagecount=off or -Tstatus=off.
After this, the filter forks a child process to handle error reports
from the printer and then transfers the job to the printer. After
the job has been transferred, the child process is terminated and
the filter process tries to restablish synchronization with the
printer and read the page counter. It will then report the status
of the printer and exit.
* The printer status response handling is based on the responses returned by
the HP4m+ printer. According to the PJL manual there is no variation.
(In practice there are minor variations of error message formats).
* The System Administrator can check the filters-printer configuration by
Tracing the chars sent to the printer. This is requested by setting an env
variable in one of the configuration files.
(****** also the -Tdebug=level option ******)
Experience at CTI
* The filters for series III have been installed and operating on printer
models III, IIID and IIISi at C.T.I. (a total number of five printers)
serving Ascii, PostScript and PCL requests from Unix, VMS and Novell
environments through a PLP printer server running on a SunOS 4.1.3 platform.
The results have been quite satisfactory.
Especially with the IIISi printer the printing is fast. It could be even
faster but there is the limiting reason of having to accompany with nulls
the language switching command (for PCL or PostScript). While printer is
receiving the nulls the filter process should sleep to give the printer the
chance to make the transition. A lot of hard effort had really to be made to
discover why these nulls had to be sent and what is the optimum number for
each printer type.
* The series 4 filters are currently used to drive an HP 4M and an HP 4MPlus
network printers. There have not been reported any problems apart from some
kind of delay. It seems that the printer takes some time to respond to the
status requests and this probably is the real cause of the filter delay.
* The filter appears to work well with HP products. There are some other
printers that do support PJL that it does not work well with. However,
if -Tstatus=off is used, it appears to work well.
(7) Related e-mail lists
Send your comments or suggestions to distribution e-mail list:
email@example.com - PLP/LPRng support