[Foomatic] cdj880 driver produces bad PCL

Patrick Powell papowell at astart.com
Sat Jan 31 13:57:04 PST 2004


On Fri, Jan 23, 2004 at 10:33:04AM -0800, Patrick Powell wrote:
> Perhaps it is fate or bad luck,  but the very next driver I looked
> at, purely at random, had a problem as well.
> 
> TestParse_PCL
> 
> test 0x04
> 
>  # multiple command escape sequence "\x1b&l2aolE"
> Page Size = 2 "\x1b&l2A"
> Page Orientation = 0 "\x1b&l0O"
> Perforation Skip = 0 "\x1b&l0L"
> Top Margin = 0 "\x1b&l0E"
> Unknown escape sequence "\x1b*o1M"
> Media Type = 0 "\x1b&l0M"
> Vertical Cursor Position Units = 76 "\x1b*p76Y"
> Mystery PCL Command = 26 "\x1b*g26W" DATA "\x02\x04\x02\x58\x02\x58\x00\x02\x02\x58\x02\x58\x00\x04\x02\x58\x02\x58\x00\x04\x02\x58\x02\x58\x00\x04"
> Start Raster Graphics = 1 "\x1b*r1A"
>  # Escape sequence not terminated correctly: "\x1b*b2m"
>  # multiple command escape sequence "\x1b*b2m"
> Set Compresion Method = 2 "\x1b*b2M"
> Raster Y Offset = 2980 "\x1b*b2980Y"
> 
> The Mystery PCL Command appears to be device specific, and
> is not documented in the PCL reference materials.
> 
> However, the command "\x1b*b2m" is followed by a ESC (\x1b),
> which is invalid PCL format.

The problem is in the gdevcd8.c and gdevcdj.c files:

/* Configure the printer and start Raster mode */
private void
cdj850_start_raster_mode(gx_device_printer * pdev, int paper_size,
			 FILE * prn_stream)
...
    /* From now on, all escape commands start with \033*b, so we
     * combine them (if the printer supports this). */
    fputs("\033*b", prn_stream);
    /* Set compression if the mode has been defined. */
    if (cdj850->compression)
	fprintf(prn_stream, "%dm", cdj850->compression);

    return;
}				/* end configure raster-mode */

If you observe the last couple of lines, you get:
    \033*b1m
in the output stream.

An intensive examination of the code used to generate the
output (as well as the gdevcdj.c code) indicates that the
author forgot to make the terminating command an upper
case command.  A horrible kludge is introduced in the
cdj_terminate_page code where they have:


private void
cdj850_terminate_page(gx_device_printer * pdev, FILE * prn_stream)
{
    fputs("0M", prn_stream);	/* Reset compression */
    fputs("\033*rC\033E", prn_stream);	/* End Graphics, Reset */
    fputs("\033&l0H", prn_stream);	/* eject page */
}


Note the "0M" entry to terminate compresssion.  However,
there is an \033E (PCL End of JOB) in the output as well.
this has the interesting side effect of reseting the
page selection code.

This most likely should be replaced by:

private void
cdj850_terminate_page(gx_device_printer * pdev, FILE * prn_stream)
{
    fputs("0M", prn_stream);	/* Reset compression */
    fputs("\033*rC", prn_stream);	/* End Graphics */
    fputs("\014", prn_stream);	/* eject page */
}


I suspect that this might be the origin of some odd problems
with setting PCL options.


Also,  the PCL command to do page eject (ESC &l0H) is used,
rather than the 'standard' form feed (FF).

I really need a printer to test this...

Patrick Powell




More information about the Printing-foomatic mailing list