[cups.development] PJL for PCL printer
Michael Sweet
msweet at apple.com
Tue Mar 16 10:01:38 PDT 2010
On Mar 16, 2010, at 1:55 AM, Matthew O'Donnell wrote:
> ...
> Thanks very much for this info, it was very helpful, my apologies for taking so long to reply.
> I have still not quite mastered this - I am trying to issue device specific (Oki) PJL commands, and can only find a way to issue some standard PJL commands (e.g. @PJL SET RESOLUTION, @PJL SET PAPERWIDTH). Is there anyway to include a block of device specific PJL, without rewriting the rastertopclx.c filter?
If you are looking for generic job startup code, use:
*cupsPJL StartJob: "...."
in the PPD file.
From the old DDK documentation:
PJL Attributes
The HP-PCL driver also supports extensive Printer Job Language (PJL) commands through a combination of PPD attributes and options. Table 3-3 lists the PJL attributes that are supported along with the PPD options they map to. PJL attributes are specified using the Attribute directive using the cupsPJL keyword. For example, the following attribute provides the PJL commands to enable or disable the resolution enhancement features of the printer:
Attribute cupsPJL cupsRET
"@PJL SET SMOOTHING=%?False:OFF;%?True:ON;%n"
The directive, Attribute, is followed by the attribute keyword, cupsPJL, the attribute name, cupsRET, and the attribute value, in this case a PJL command string. The command string consists of PJL command text and special substitution fields starting with the percent (%) character.
In the example above, the %? substitution conditionally inserts some text if the string matches the option value, typically the name of the choice. In this case, we have two conditional substitutions. The first inserts the text OFF if the cupsRET option is False, and the second inserts the text ON if the option is True. The syntax is as follows:
%?look for:insert;
Multiple conditional substitutions can be listed up to about 230 characters - the PPD file format imposed a 255 character line length limit, and attribute values cannot span multiple lines.
Aside from conditional substitutions, the HP-PCL driver supports the following additional substitutions. Unknown substitutions are inserted verbatim:
%% - inserts the percent character (%).
%b - inserts the job-billing value for this job.
%h - inserts the job-originating-hostname value for this job.
%j - inserts the job-id value for this job.
%n - inserts the carriage return (ASCII CR or 0D hex) and linefeed (ASCII LF or 0A hex) characters.
%q - inserts the double quote character (").
%s - inserts the current option value or choice.
%t - inserts the name/title of this job.
%u - inserts the job-originating-username value for this job.
Adding PJL Options to the Basic LaserJet Driver
All three HP LaserJet models support additional options via PJL commands. Listing 3-2 shows a modified version of the driver which adds support the resolution enhancement and toner saving features of the printers.
The new resolution enhancement option consists of a PPD attribute containing the cupsRET command followed by the cupsREToption. Since this option applies to the entire job, the option is placed in the DocumentSetup section:
Attribute cupsPJL cupsRET
"@PJL SET SMOOTHING=%?False:OFF;%?True:ON;%n"
Option "cupsRET/Smoothing" Boolean DocumentSetup 10
Choice "False/Off" ""
*Choice "True/On" ""
The toner saving option is added the same way using the cupsTonerSave attribute and option:
Attribute cupsPJL cupsTonerSave
"@PJL SET ECONOMODE=%?False:OFF;%?True:ON;%n"
Option "cupsTonerSave/Save Toner" Boolean DocumentSetup 10
*Choice "False/No" ""
Choice "True/Yes" ""
Since we didn't specify a group for these options, they will be put in the General option group.
Table 3-3, PJL attributes and options
Attribute Option Description
COLORSPACE. ColorModel Varies Specifies the colorspace to set at the beginning of the job.
cupsBooklet cupsBooklet Specifies the PJL commands to send for setting the booklet printing mode.
cupsPunch cupsPunch Specifies the PJL commands to send for setting the punch mode.
cupsRET cupsRET Specifies the PJL commands to set the resolution enhancement mode.
cupsStaple cupsStaple Specifies the PJL commands to send for setting the stapler mode.
cupsTonerSave cupsTonerSave Specifies the PJL commands to set the toner saving mode.
Duplex Duplex Specifies the PJL commands to send for setting the duplex mode.
EndJob N/A Specifies the PJL commands to send at the end of a job.
Jog Varies Specifies the PJL commands to send for setting the output jogging.
MediaClass Varies Specifies the PJL commands to send for setting the media class.
MediaColor Varies Specifies the PJL commands to send for setting the media color.
MediaType MediaType Specifies the PJL commands to send for setting the media type.
OutputType Varies Specifies the PJL commands to send for setting the output type.
RENDERINTENT. ColorModel Varies Specifies the rendering intent to set at the beginning of the job.
RENDERMODE. ColorModel Varies Specifies the render mode to set at the beginning of the job.
Table 3-3, PJL attributes and options, continued...
Attribute Option Description
StartJob N/A Specifies the PJL commands to send at the beginning of a job.
Tumble Duplex Specifies the PJL commands to send for setting the duplex tumble mode.
________________________________________________________________________
Michael Sweet, Senior Printing System Engineer, PWG Chair
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cups.org/pipermail/cups/attachments/20100316/be65ee4b/attachment.html>
More information about the cups
mailing list