The KLJetTool Handbook: Getting KLJetTool to work

Next Previous Table of Contents

### 3. Getting KLJetTool to work

Some Linux distributions have an overly eager printing subsystem that doesn't respect the PJL files generated by LJetTool. The printing subsystem these systems does not recognize a PJL file as such and tries to transform it using its filters. This will cause KLJetTool to malfunction.

This section describes the steps necessary to get LJetTool to work on pre 5.0 RedHat Linux systems (KLJetTool should work out of the box on RedHat linux 5.0 based distributions ). I assume similar steps might be necessary on other systems. However, the steps which need to be undertaken are not difficult. All that needs to be done is to make sure that the printing subsystem sends PJL files unmodified to the printer.

A RedHat Linux system does not recognize PJL out of the box, and tries to do weird things with it rather then sending it unmodified to the printer, so we have to teach it how to deal with a PJL file. However before you make the changes suggested here to your system, be sure that KLJetTool really doesn't work on your system. RedHat and other distributions might well have updated its printing subsystem by the time you read this.

I assume other distributions with an equally 'sophisticated' printer subsytem such as the RedHat system might also need to be taught how to deal with PJL ( Printer Job Language ) files that are send to the printer.

On a redhat system the script `/var/spool/lpd/lp/filter` is invoked from `/etc/printcap`, each time something is printed using the command 'lpr'. The filter runs the program 'file' on the file to be printed and 'file' will tell the 'filter' script what sort of document we are dealing with. Then depending on the type of the document the right program is run to produce output in a format that the printer can understand. The program 'file' uses the file `/etc/magic` to determine the type of the document to be printed ( e.g PostScript, dvi, text etc )

For example, if I print a postscript document, myfile.ps, file tells the 'filter' script that we are dealing with a postscript file and 'filter' will run ghostscript first to convert myfile.ps into pcl 5, a language my laserjet understands, before sending the file to the printer.

Unfortunately a RedHat system doesn't recognize a PJL file and tries to do wrong things with the PJL file rather than sending it out to the printer unmodified.

In order to get LJetTool to work on a RedHat system we only need to do two things:

- Add a line to the `/etc/magic` file so that the program 'file' will correctly recognize a PJL file as a PJL file. Simply add the following two lines to your /etc/magic file. Where in the file `/etc/magic` add these lines doesn't really matter.

  > `

  >     # HP Printer Job Language, Bernd Wuebben (wuebben@math.cornell.edu)
  >     0       string          \033%-12345X     HP PJL printer commands

  > `

- teach the /var/spool/lpd/lp/filter script what to do with PJL files. This can be done by adding the following two lines to the 'filter' script

  > `

  >        *pjl* )
  >                                                   startpnt="INPUT-to-prdata";;

  > `

  If you have a look at the filter script it will be clear where to add it ( at about line 220 in the version I have ). These lines simply tell the script to leave a PJL file alone and to send it unmodified to the printer.

I have included a copy of my filter script as well as my /etc/magic. You can use them if you have trouble making the above outlined modifications. You should be able to find them in the same directory where you found KLJetTool documentation.

I would love to received instructions for what ( if anything ) needs to be done to get LJetTool to work on other systems who use an elaborate printing filter subsystem.

Next Previous Table of Contents