Next Previous Contents

2. Installation and Express Configuration

Before you do an installation, you should read the following instructions. You will need to:

  1. Use GNU Make. Don't even think about trying to use another make unless you are a Wizard. And even the Wizards would download the GNU Make.
  2. Use an ANSI C compiler.
  3. Read the HOWTO/ifhp-HOWTO.{ps,html,text,...} file(s). You are doing this now, so you are off to a good start.
  4. Generate the executables.
  5. Install the configuration files.
  6. Run some simple standalone tests, i.e. - without using the print spooler.
  7. Modify the configuration files to suit your sites requirements.
  8. Install the executables.
  9. Modify the printcap files and/or add other information to the printcap files.
  10. Try the ifhp filter with the working print spooler.

In addition, you might want to get the following software, which can be used with ifhp.

a2ps - Ascii Text To PostScript Converter

http://www-inf.enst.fr/~demaille/a2ps/ This package does a very good job of text to PostScript conversion.

enscript - GNU Enscript

http://www.gnu.org/ This package is a simpler version of a2ps, and is faster and smaller.

Unix File Utility - Determines the type of file

ftp://ftp.astron.com/pub/file/ or ftp://ftp.deshaw.com/pub/file/.

LPRng Print Spooler

http://www.astart.com

2.1 Configure and Compilation

The ifhp filter uses the AUTOCONF configuration facilty. The following set of commands will generate configuration files and compile and install the software and documentation.

It is highly unlikely that you will encounter problems with compilation. Usually these are due to type definition conflicts in include files. If you encounter these, please report these to the LPRng mailing list.

configure
make all
# installs ifhp and textps in /usr/local/lib/filters
# installs ifhp.conf in /etc
#  (if already present, in /etc/ifhp.conf.sample)
make install

2.2 Printcap Configuration

The basic LPRng printcap configuration is:

# printer setup
# force clients (lpr, lpq, to use server)
lp:lp=lp@serverhost
# server information
lp:server
  :sd=spooldir
  :...
  
  # version 1 - using -T options
  #path to ifhp filter
  :if=/.../ifhp -Toptions
  :of=/.../ifhp -Toptions
  
  # version 2 - using ifhp printcap entry
  :ifhp=options
  :if=/.../ifhp
  :of=/.../ifhp

As shown, options can be passed on the command line using the -Toption,option method or put into the :ifhp=option,option list.

Since commas are used to separate options in the -T option list, if you want to specify an option with a list of values the values need to separated with a semicolon (;) as shown below:

ifhp -Tconfig=./ifhp.conf;/etc/ifhp.conf;./ifhp.conf

By convention, the ifhp filter takes its input from STDIN (file descriptor 0) and expects to write its output to STDOUT (file descriptor 1), which is normally connected to a printer. Error and trace information are written to STDERR (file descriptor 2).

As shipped, the ifhp.conf file is configured to support a PJL printer which has the following configuration. The configuration flags that support or enable these features are shown as well.

  1. PJL support (pjl).
  2. PostScript (PS) support (ps).
  3. PCL support (pcl).
  4. Text files printed as PCL (text, default_language=pcl).
  5. Banner printing done by LPRng spooler (banner@)
  6. Status reported from printer (over bidirectional file descriptor 1) (status)
  7. Synchronize at start and end (sync)
  8. Get pagecount information (pagecount)

The following printers have specfic configuration sections which are invoked by using the model=name option. The HP DeskJet and DesignJet printers use the same hpdj prefix with the model appended. See Appendix A in the Printer Job Language Technical Reference Manual for a detailed explanation of these names.

apple     hp4000      hp4          hp4l         hp4lc
hp4m      hp4ml       hp4mp        hp4mplus     hp4mv
hp4p      hp4pj       hp4plus      hp4si        hp4simx
hp4v      hp5         hp5l         hp5m         hp5mp
hp5p      hp5si       hp5simopier  hp5simx      hp6l
hp6mp     hp6p        hpcolorlj5   hpcolorlj5m  hpcolorlj
hpdj1200c hpdj1600c   hpdj2000cp   hpdj200      hpdj220
hpdj230   hpdj2500cp  hpdj250c     hpdj330      hpdj350c
hpdj350c  hpdj430     hpdj450c     hpdj455ca    hpdj600
hpdj650c  hpdj700     hpdj750c     hpdj750cplus hpdj755cm
hpiiisi   hpljpro     hppjxl300    postscript   ps
tek       qms1725

In addition to HP printers, there is also generic support for PostScript only printers.

2.3 PS, PCL, PJL Printer with Network Connection

This is the most common configuration, and the printcap entry would have the following format:

# printer setup
# force clients (lpr, lpq, to use server)
lp:lp=lp@serverhost
# server information
lp:server
  :sd=spooldir
  :...
  #:lp=printer ip address or DNS name%9100
  # eg - :lp=nwpr%9100
  # eg - :lp=10.1.1.1%9100
  :lp=10.1.1.1%9100
  #path to ifhp filter
  :if=/.../ifhp
  :of=/.../ifhp

If you have an HP printer in the above list, you can use:

# printer setup
# force clients (lpr, lpq, to use server)
lp:lp=lp@serverhost
# server information
lp:server
  :sd=spooldir
  :...
  :lp=printer ip address or DNS name%9100
  :ifhp=model=name   #path to ifhp filter
  :if=/.../ifhp
  :of=/.../ifhp

2.4 PS, PCL, PJL Printer with Parallel Port Connection

Since the parallel port is unidirectional, you cannot get status back, and need to use the status@ option to prevent the ifhp filter from expecting it. The printcap entry would have the following format:

# printer setup
# force clients (lpr, lpq, to use server)
lp:lp=lp@serverhost
# server information
lp:server
  :sd=spooldir
  :...
  # parallel port
  :lp=/dev/lpt
  :ifhp=status@
  #path to ifhp filter
  :if=/.../ifhp
  :of=/.../ifhp

2.5 PS, PCL, PJL Printer with Serial Port

The LPRng print spooler will open and set the serial line characteristics, and pass the open connection to the ifhp filter. The tty connection must pass all 8 bits with no parity, and should use hardware flow control if at all possible. for your system,

# printer setup
# force clients (lpr, lpq, to use server)
lp:lp=lp@serverhost
# server information
lp:server
  :sd=spooldir
  :...
  # serial port
  :lp=/dev/ttyxxx
  :stty=38400 -echo -crmod -raw -oddp -evenp \
   ixon pass8 -ixany cbreak crtscts
  #path to ifhp filter
  :if=/.../ifhp
  :of=/.../ifhp

2.6 PostScript Only Printer

Use the configuration appropriate to the printer connection, and then use the pjl@, pcl@, and text@ option to inhibit everything but PostScript.

# printer setup
# force clients (lpr, lpq, to use server)
lp:lp=lp@serverhost
# server information
lp:server
  :sd=spooldir
  :...
  :ifhp=pcl@,pjl@,text@
  #path to ifhp filter
  :if=/.../ifhp
  :of=/.../ifhp

If you have a parallel port printer with no PostScript support, you would use:

:ifhp=pcl@,pjl@,text@

An alternative is to use the model=ps configuration section of the default /etc/ifhp.conf file.

# printer setup
# force clients (lpr, lpq, to use server)
lp:lp=lp@serverhost
# server information
lp:server
  :sd=spooldir
  :...
  :ifhp=model=ps   #path to ifhp filter
  :if=/.../ifhp
  :of=/.../ifhp

If your printer does not like to have a PostScript EOJ (Control-D) flag at the start of a job, use the no_ps_eoj ( No PS EOJ at Start) flags. flag to remove them.

2.7 PostScript Only Printer With Text Conversion

You can use the PostScript Only configuration above, and add text to postscript conversion to it. This is done by defining the pathname to a text to PostScript conversion program and causing ifhp to use the program to convert the input file to PostScript. The a2ps program can be obtained from http://www-inf.enst.fr/~demaille/a2ps/ and does an excellent job. Also, the textps program included with this distribution does a (barely) adequate job as well.

The method outlined here assumes that the input file is a text file and that the a2ps program will convert it. The a2ps program needs to be explicitly told that output is to go to STDOUT or file descriptor 1.

text_converter=/usr/local/bin/a2ps -o-
text_converter_output=ps
tempfile=/var/tmp/ifhp
# printer setup
# force clients (lpr, lpq, to use server)
lp:lp=lp@serverhost
# server information
lp:server
  :sd=spooldir
  :...
  :ifhp=pcl@,pjl@,text@,text_converter=...,\
       text_converter_output=ps 
  #path to ifhp filter
  :if=/.../ifhp
  :of=/.../ifhp

2.8 Tektronixs Phaser Series Printer with Network Connections

The Tektronics Phaser Series printers use the Appsocket protocol when sending a job to the printer. This protocol is (briefly):

  1. The printer listens for UDP packets on port 9101 and for TCP/IP connections on port 9100.
  2. When a UDP packet is recieved on port 9101, then a reply packet containing the status is returned to the originator's address. This packet contains an status indication, in a undefined format.
  3. To send a job to the printer, a TCP/IP connection is opened to port 9100, and a PostScript job is sent. Only a single job can be sent at a time - a EOJ (CTRL-D) will terminate input and flush all following jobs.
  4. Return status will be sent in the reverse direction until the job has completed, at which point the connection will be closed.

The ifhp program supports the appsocket protocol. In order to do so, the following ifhp configuration entry can be used.

[ tek ]
appsocket
pjl@
pcl@
The appsocket option will use the appsocket protcol, and cause ifhp to open and close connections to the printer. The printcap entry should specify lp=/dev/null and provide the device IP address using the -Tdev=host%port option.
# Phaser Setup lp:server
  :lp=/dev/null
  :sd=spooldir
  :...
  :ifhp=model=tek,dev=10.0.0.1%9100
  #path to ifhp filter
  :if=/.../ifhp
  :of=/.../ifhp


Next Previous Contents