<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>The KLJetTool Handbook: Getting KLJetTool to work</TITLE>
<META HTTP-EQUIV="content-type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="keywords" CONTENT="">
<META NAME="description" CONTENT="">
</HEAD>
<BODY BGCOLOR="#ffffff" LINK="#aa0000" TEXT="#000000" > 
<FONT FACE="Helvetica">
<A HREF="http://www.kde.org/"><IMG SRC="logotp3.gif" BORDER="0" ALT="The K Desktop Environment"></A>
<HR WIDTH="100%" SIZE=2 ALIGN="CENTER" NOSHADE>

 
<P ALIGN="RIGHT">

<A HREF="kljettool-4.html">Next</A>
<A HREF="kljettool-2.html">Previous</A>
<A HREF="kljettool.html#toc3">Table of Contents</A>
</P>
<H3><A NAME="s3">3. Getting KLJetTool to work</A></H3>

<P>
<P>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.
<P>
<P>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.
<P>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.
<P>
<P>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.
<P>
<P>On a redhat system the script <CODE>/var/spool/lpd/lp/filter</CODE>
is invoked from <CODE>/etc/printcap</CODE>, 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 <CODE>/etc/magic</CODE>
to determine the type of the document to be printed ( e.g PostScript,
dvi, text etc )
<P>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. 
<P>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. 
<P>In order to get LJetTool to work on a RedHat system we only need
to do two things:
<P>
<UL>
<LI> Add a line to the <CODE>/etc/magic</CODE> 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 <CODE>/etc/magic</CODE> add these lines doesn't really matter.
<BLOCKQUOTE><CODE>
<PRE>
# HP Printer Job Language, Bernd Wuebben (wuebben@math.cornell.edu)
0       string          \033%-12345X     HP PJL printer commands
</PRE>
</CODE></BLOCKQUOTE>

</LI>
<LI> 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
<BLOCKQUOTE><CODE>
<PRE>
   *pjl* )
                                              startpnt="INPUT-to-prdata";;
</PRE>
</CODE></BLOCKQUOTE>
                
                              
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.</LI>
</UL>
<P>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.
<P>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. 
<P>   
<P>
<P ALIGN="RIGHT">

<A HREF="kljettool-4.html">Next</A>
<A HREF="kljettool-2.html">Previous</A>
<A HREF="kljettool.html#toc3">Table of Contents</A>
</P>
<CENTER>
<HR WIDTH="100%" SIZE=3 ALIGN=CENTER NOSHADE>
</CENTER>    
</FONT>

 
</BODY>
</HTML>
