4 - Developing PostScript Printer Drivers

This chapter describes how to develop PPD files for PostScript printer drivers.

Overview of PostScript Driver Development

The PPD compiler is capable of producing PPD files for PostScript printers just as easily as for non-PostScript printers. PostScript printer drivers use the ps driver type:

    DriverType ps

Required Attributes

PostScript drivers require the attributes listed in Table 4-1. If not specified, the defaults for CUPS drivers are used. A typical PostScript driver information file would include the following attributes:

    Attribute DefaultColorSpace "" Gray
    Attribute LandscapeOrientation "" Minus90
    Attribute LanguageLevel "" "3"
    Attribute Product "" "(Foo LaserProofer 2000)"
    Attribute PSVersion "" "(3010) 0"
    Attribute TTRasterizer "" Type42
Table 4-1, Required PostScript printer driver attributes
Attribute Description
DefaultColorSpace The default colorspace: Gray, RGB, CMY, or CMYK. If not specified, then RGB is assumed.
LandscapeOrientation The preferred landscape orientation: Plus90, Minus90, or Any. If not specified, Plus90 is assumed.
LanguageLevel The PostScript language level supported by the device: 1, 2, or 3. If not specified, 2 is assumed.
Product The string returned by the PostScript product operator, which must include parenthesis to conform with PostScript syntax rules for strings. Multiple Product attributes may be specified to support multiple products with the same PPD file. If not specified, "(ESP Ghostscript)" and "(GNU Ghostscript)" are assumed.
PSVersion The PostScript interpreter version numbers as returned by the version and revision operators. The required format is "(version) revision". Multiple PSVersion attributes may be specified to support multiple interpreter version numbers. If not specified, "(3010) 705" and "(3010) 707" are assumed.
TTRasterizer The type of TrueType font rasterizer supported by the device, if any. The supported values are None, Accept68k, Type42, and TrueImage. If not specified, None is assumed.

Query Commands

Most PostScript printer PPD files include query commands (?PageSize, etc.) that allow applications to query the printer for its current settings and configuration. Query commands are included in driver information files as attributes. For example, the query command for the PageSize option might look like the following:

    Attribute "?PageSize" "" "
          save
          currentpagedevice /PageSize get aload pop
          2 copy gt {exch} if (Unknown)
          23 dict
                  dup [612 792] (Letter) put
                  dup [612 1008] (Legal) put
                  dup [595 842] (A4) put
                  {exch aload pop 4 index sub abs 5 le exch 
                   5 index sub abs 5 le and
                  {exch pop exit} {pop} ifelse
          } bind forall = flush pop pop
          restore"

Query commands can span multiple lines, however no single line may contain more than 255 characters.

Adding Filters

Normally a PostScript printer driver will not utilize any additional print filters. For drivers that provide additional filters such as a CUPS command file filter for doing printer maintenance, you must also list the following Filter directive to handle printing PostScript files:

    Filter application/vnd.cups-postscript 0 -

Importing Existing PostScript Drivers

The ppdi(1) utility included with the CUPS DDK imports existing PPD files into driver information files. This allows you to make modifications and localize PPD files for other languages with great ease. Use the following command to import a single PPD file called filename.ppd into a driver information file called filename.drv:

    ppdi filename.drv filename.ppd ENTER

The driver information file is created if it does not exist. Otherwise the PPD file information is appended to the end of the file. You can use shell wildcards to import whole directories of PPD files:

    ppdi filename.drv *.ppd ENTER

Once imported, you can edit the driver information file and use the ppdc program to regenerate the PPD files:

    ppdc filename.drv ENTER