Converting PCL to HP JetReady
using CUPS

12/04/2007
Eric Low

Some of the cheaper models in Hewlett-Packard's new line of laser printers are pretty darned fast.. because they do absolutely no conversion or translation in the printer itself. This is called host-based printing and makes the print driver do all the work. They don't even know PostScript! It's one of those things I found out after it was too late. All of our programs print PCL, and who would've thought that a brand new HP laser printer (a moderately priced one, too) would not understand PCL, especially since it's HP's own printing language.

Ok, so how to get around it? Linux to the rescue! Isn't it that way 99% of the time? :) Time for some CUPS magic.

 

To do this conversion, we have to use CUPS filters. These are located in /usr/lib/cups/filter (on my Suse 10.3 box at least).

The filters that are used are determined by the following files:

/etc/cups/mime.types
/etc/sups/mime.convs
/etc/cups/ppd/printername.ppd

When a print job first arrives, it is labeled with a MIME type. CUPS compares this mime type with those listed in mime.types in order; if it is not in there, it is discarded. Once cups finds a mime type that matches, it stops examining the mime.types file. If you look at that file, you'll notice that some of the types actually do comparisons of the data contained in the job to determine the mime type. Since we are printing PCL from a Windows machine using the LaserJet 5siMX PCL drivers, it contains a string that makes it match the application/vnd.cups-raw mime type. If I was to print PCL using incomplete headers, though, it would not match this string and would come in as application/octet-stream. Either of these types, of course, is considered a RAW mime type.

Through trial and error, I noticed that one CUPS sees a mime type that begins with application/vnd. it considers the filtering to be done and passes it on to the printer's backend.

I needed to filter the raw PCL that was arriving from the 5siMX driver, so I went into mime.types and commented out the line that identified the job as application/vnd.cups-raw. The only other line left was application/octet-stream, so now my jobs would be labelled as that type as they move onto filters specified in the mime.convs file.

 

* Keep in mind that if, following the mime conversion chains, it never gets to an application/vnd.* mime type, CUPS will consider it an unknown mime type!

* Help files for Ghostscript are under /usr/share/ghostscript/8.15

* Using PCL6 (or pcl2pdf) does NOT output font information. It should only be used for graphics, etc.

* PCL6 does not seem to work unless it contains embedded soft font information. Setup problem?