# CUPS PPD Extensions

This specification describes the attributes and extensions that CUPS adds to Adobe TechNote #5003: PostScript Printer Description File Format Specification Version 4.3. PostScript Printer Description ("PPD") files describe the capabilities of each printer and are used by CUPS to support printer-specific features and intelligent filtering.

See Also | Programming: Developing PostScript Printer Drivers Programming: Developing Raster Printer Drivers Programming: Filter and Backend Programming Programming: Introduction to the PPD Compiler Programming: Raster API References: PPD Compiler Driver Information File Reference

## Contents

- PPD File Syntax
- Auto-Configuration
  - APAutoSetupTool
  - ?MainKeyword
  - OIDMainKeyword
- Color Profiles
  - cupsColorProfile
  - cupsICCProfile
  - Custom Color Matching Support
- Constraints
  - cupsUIConstraints
  - cupsUIResolver
- Globalized PPD Support
- <span class="info">CUPS 1.3/macOS 10.6</span>Custom Options
- Writing PostScript Option Commands for Raster Drivers
- Media Keywords
  - cupsMediaQualifier2
  - cupsMediaQualifier3
  - cupsMinSize
  - cupsMaxSize
  - cupsPageSizeCategory
- General Attributes
  - cupsBackSide
  - cupsCommands
  - cupsEvenDuplex
  - cupsFax
  - cupsFilter
  - cupsFilter2
  - cupsFinishingTemplate
  - cupsFlipDuplex
  - cupsIPPFinishings
  - cupsIPPReason
  - cupsIPPSupplies
  - cupsJobAccountId
  - cupsJobAccountingUserId
  - cupsJobPassword
  - cupsLanguages
  - cupsMandatory
  - cupsManualCopies
  - cupsMarkerName
  - cupsMarkerNotice
  - cupsMaxCopies
  - cupsModelNumber
  - cupsPJLCharset
  - cupsPJLDisplay
  - cupsPortMonitor
  - cupsPreFilter
  - cupsPrintQuality
  - cupsSingleFile
  - cupsSNMPSupplies
  - cupsVersion
  - JCLToPDFInterpreter
- macOS Attributes
  - APDialogExtension
  - APDuplexRequiresFlippedMargin
  - APHelpBook
  - APICADriver
  - APPrinterIconPath
  - APPrinterLowInkTool
  - APPrinterPreset
  - APPrinterUtilityPath
  - APScannerOnly
  - APScanAppBundleID
- Change History

## PPD File Syntax

The PPD format is text-based and uses lines of up to 255 characters terminated by a carriage return, linefeed, or combination of carriage return and line feed. The following ABNF definition [RFC5234] defines the general format of lines in a PPD file:

    PPD-FILE = HEADER +(DATA / COMMENT / LINE-END)

    HEADER   = "*PPD-Adobe:" *WSP DQUOTE VERSION DQUOTE LINE-END

    VERSION  = "4.0" / "4.1" / "4.2" / "4.3"

    COMMENT  = "*%" *TCHAR LINE-END

    DATA     = "*" 1*KCHAR [ WSP 1*KCHAR [ "/" 1*TCHAR ] ] ":"
               1*(*WSP VALUE) LINE-END

    VALUE    = 1*TCHAR / DQUOTE 1*SCHAR DQUOTE

    KCHAR    = ALPHA / DIGIT / "_" / "." / "-"

    SCHAR    = LINE-END / WSP / %x21.23-7E.A0-FF

    TCHAR    = %x20-7E.A0-FF

    LINE-END = CR / LF / CR LF

## Auto-Configuration

CUPS supports several methods of auto-configuration via PPD keywords.

### macOS 10.5 APAutoSetupTool

*APAutoSetupTool: "/LibraryPrinters/vendor/filename"

This macOS keyword defines a program that sets the default option choices. It is run when a printer is added from the Add Printer window or the Nearby Printers list in the Print dialog.

The program is provided with two arguments: the printer's device URI and the PPD file to be used for the printer. The program must write an updated PPD file to stdout.

Examples:

    *% Use our setup tool when adding a printer
    *APAutoSetupTool: "/Library/Printers/vendor/Tools/autosetuptool"

### macOS 10.2/CUPS 1.4?MainKeyword

*?MainKeyword: "
PostScript query code that writes a message using the = operator...
"
*End

The `?MainKeyword` keyword defines PostScript code that determines the currently selected/enabled option keyword (choice) for the main keyword (option). It is typically used when communicating with USB, serial, Appletalk, and AppSocket (port 9100) printers.

The PostScript code typically sends its response back using the `=` operator.

Example:

    *OpenUI OptionDuplex/Duplexer Installed: Boolean
    *DuplexOptionDuplex: False
    *OptionDuplex False/Not Installed: ""
    *OptionDuplex True/Installed: ""

    *% Query the printer for the presence of the duplexer option...
    *?OptionDuplex: "
      currentpagedevice /Duplex known
      {(True)} {(False)} ifelse
      = flush
    "
    *End
    *CloseUI: OptionDuplex

### macOS 10.4/CUPS 1.5 OIDMainKeyword

*?OIDMainKeyword: ".n.n.n..."
*OIDMainKeyword OptionKeyword1: "value"
...
*OIDMainKeyword OptionKeywordN: "value"

The `OIDMainKeyword` keyword is used to define SNMP OIDs that map to installable options. The first (query) line defines the OID to lookup on the network device. The second and subsequent keywords define a mapping from OID value to option keyword. Since SNMP is an IP-based network protocol, this method is typically only used to configure AppSocket, IPP, and LPD network printers.

Examples:

    *% Get the installed memory on the printer...
    *?OIDInstalledMemory: ".1.3.6.1.2.1.25.2.2.0"
    *OIDInstalledMemory 16MB: "16384 KBytes"
    *OIDInstalledMemory 32MB: "32768 KBytes"
    *OIDInstalledMemory 48MB: "49152 KBytes"
    *OIDInstalledMemory 72MB: "73728 KBytes"

## Color Profiles

CUPS supports three types of color profiles. The first type is based on sRGB and is used by the standard CUPS raster filters and GPL Ghostscript. The second type is based on ICC profiles and is used by the Quartz-based filters on macOS. The final type is based on well-known colorspaces such as sRGB and Adobe RGB.

> Note:

> At this time, none of the CUPS raster filters support ICC profiles. This will be addressed as time and resources permit.

### Deprecated cupsColorProfile

*cupsColorProfile Resolution/MediaType: "density gamma m00 m01 m02 m10 m11 m12 m20 m21 m22"

This string keyword specifies an sRGB-based color profile consisting of gamma and density controls and a 3x3 CMY color transform matrix. This keyword is not supported on macOS.

The Resolution and MediaType values may be "-" to act as a wildcard. Otherwise they must match one of the `Resolution` or `MediaType` option keywords defined in the PPD file.

The density and gamma values define gamma and density adjustment function such that:

    f(x) = density * x gamma

The m00 through m22 values define a 3x3 transformation matrix for the CMY color values. The density function is applied after the CMY transformation:

    | m00 m01 m02 |
    | m10 m11 m12 |
    | m20 m21 m22 |

Examples:

    *% Specify a profile for printing at 360dpi on all media types
    *cupsColorProfile 360dpi/-: "1.0 1.5 1.0 0.0 -0.2 -0.4 1.0 0.0 -0.2 0.0 1.0"

    *% Specify a profile for printing at 720dpi on Glossy media
    *cupsColorProfile 720dpi/Glossy: "1.0 2.5 1.0 0.0 -0.2 -0.4 1.0 0.0 -0.2 0.0 1.0"

    *% Specify a default profile for printing at all other resolutions and media types
    *cupsColorProfile -/-: "0.9 2.0 1.0 0.0 -0.2 -0.4 1.0 0.0 -0.2 0.0 1.0"

### macOS 10.3/CUPS 1.2 cupsICCProfile

*cupsICCProfile ColorModel.MediaType.Resolution/Description: "filename"

This keyword specifies an ICC color profile that is used to convert the document colors to the device colorspace. The `ColorModel`, `MediaType`, and `Resolution` option keywords specify a selector for color profiles. If omitted, the color profile will match any option keyword for the corresponding main keyword.

The `Description` specifies human-readable text that is associated with the color profile. The `filename` portion specifies the ICC color profile to use; if the filename is not absolute, it is loaded relative to the /usr/share/cups/profiles directory.

Examples:

    *% Specify a profile for CMYK printing at 360dpi on all media types
    *cupsICCProfile CMYK..360dpi/360dpi CMYK: "/Library/Printers/vendor/Profiles/foo-360-cmyk.icc"

    *% Specify a profile for RGB printing at 720dpi on Glossy media
    *cupsColorProfile RGB.Glossy.720dpi/720dpi Glossy: "/Library/Printers/vendor/Profiles/foo-720-glossy-rgb.icc"

    *% Specify a default profile for printing at all other resolutions and media types
    *cupsICCProfile ../Default: "/Library/Printers/vendor/Profiles/foo-default.icc"

#### Customizing the Profile Selection Keywords

The `ColorModel`, `MediaType`, and `Resolution` main keywords can be reassigned to different main keywords, allowing drivers to do color profile selection based on different parameters. The `cupsICCQualifier1`, `cupsICCQualifier2`, and `cupsICCQualifier3` keywords define the mapping from selector to main keyword:

    *cupsICCQualifier1: MainKeyword1
    *cupsICCQualifier2: MainKeyword2
    *cupsICCQualifier3: MainKeyword3

The default mapping is as follows:

    *cupsICCQualifier1: ColorModel
    *cupsICCQualifier2: MediaType
    *cupsICCQualifier3: Resolution

### macOS 10.4 Custom Color Matching Support

*APSupportsCustomColorMatching: true
*APCustomColorMatchingName name/text: ""
*APCustomColorMatchingProfile: profile
*APDefaultCustomColorMatchingProfile: profile

These keywords tell the macOS raster filters that the printer driver provides its own custom color matching and that generic color profiles should be used when generating 1-, 3-, and 4-component raster data as requested by the driver. The `APCustomColorMatchingProfile` and `APDefaultColorMatchingProfile` keywords specify alternate color profiles (sRGB or AdobeRGB) to use for 3-color (RGB) raster data.

> Note:

> Prior to macOS 10.6, the default RGB color space was Apple's "GenericRGB". The new default in macOS 10.6 and later is "sRGB". For more information, see "macOS v10.6: About gamma 2.2" on Apple's support site.

#### macOS 10.5 APCustomColorMatchingName

*APCustomColorMatchingName name/text: ""

This keyword defines an alternate name for the color matching provided by a driver in the Color Matching print panel. The default is to use the name "Vendor Matching" or its localized equivalent.

Examples:

    *% Define the names for our color matching...
    *APCustomColorMatchingName name/AcmeColor(tm): ""
    *fr.APCustomColorMatchingName name/La AcmeColor(tm): ""

#### macOS 10.5 APCustomColorMatchingProfile

*APCustomColorMatchingProfile: name

This keyword defines a supported RGB color profile that can be used when doing custom color matching. Currently only `sRGB`, `AdobeRGB`, and `GenericRGB` are supported. If not specified, RGB data will use the GenericRGB colorspace.

> Note:

> If you provide multiple `APCustomColorMatchingProfile` keywords, you are responsible for providing the necessary user interface controls to select the profile in a print dialog pane. Add the named profile to the print settings using the key `kPMCustomColorMatchingProfileKey`.

Examples:

    *% Use sRGB for RGB color by default, but support both sRGB and AdobeRGB
    *APSupportsCustomColorMatching: true
    *APDefaultCustomColorMatchingProfile: sRGB
    *APCustomColorMatchingProfile: sRGB
    *APCustomColorMatchingProfile: AdobeRGB

#### macOS 10.5 APDefaultCustomColorMatchingProfile

*APDefaultCustomColorMatchingProfile: name

This keyword defines the default RGB color profile that will be used when doing custom color matching. Currently only `sRGB`, `AdobeRGB`, and `GenericRGB` are supported.

Examples:

    *% Use sRGB for RGB color by default
    *APSupportsCustomColorMatching: true
    *APDefaultCustomColorMatchingProfile: sRGB

#### macOS 10.4 APSupportsCustomColorMatching

*APSupportsCustomColorMatching: boolean

This keyword specifies that the driver provides its own custom color matching. When `true`, the default hand-off colorspace will be GenericGray, GenericRGB, or GenericCMYK depending on the number of components the driver requests. The `APDefaultCustomColorMatchingProfile` keyword can be used to override the default 3-component (RGB) colorspace.

The default for `APSupportsCustomColorMatching` is `false`.

Examples:

    *APSupportsCustomColorMatching: true
    *APDefaultCustomColorMatchingProfile: sRGB

## Constraints

Constraints are option choices that are not allowed by the driver or device, for example printing 2-sided transparencies. All versions of CUPS support constraints defined by the legacy Adobe `UIConstraints` and `NonUIConstraints` keywords which support conflicts between any two option choices, for example:

    *% Do not allow 2-sided printing on transparency media
    *UIConstraints: "*Duplex *MediaType Transparency"
    *UIConstraints: "*MediaType Transparency *Duplex"

While nearly all constraints can be expressed using these keywords, there are valid scenarios requiring constraints between more than two option choices. In addition, resolution of constraints is problematic since users and software have to guess how a particular constraint is best resolved.

CUPS 1.4 and higher define two new keywords for constraints, `cupsUIConstraints` and `cupsUIResolver`. Each `cupsUIConstraints` keyword points to a `cupsUIResolver` keyword which specifies alternate options that resolve the conflict condition. The same `cupsUIResolver` can be used by multiple `cupsUIConstraints`.

> Note:

> When developing PPD files that contain constraints, it is very important to use the cupstestppd(1) program to verify that your constraints are accurate and cannot result in unresolvable option selections.

### CUPS 1.4/macOS 10.6 cupsUIConstraints

*cupsUIConstraints resolver: "*Keyword1 *Keyword2 ..."
*cupsUIConstraints resolver: "*Keyword1 OptionKeyword1 *Keyword2 ..."
*cupsUIConstraints resolver: "*Keyword1 *Keyword2 OptionKeyword2 ..."
*cupsUIConstraints resolver: "*Keyword1 OptionKeyword1 *Keyword2 OptionKeyword2 ..."
*cupsUIConstraints: "*InstallableKeyword1 OptionKeyword1 *Keyword2 OptionKeyword2 ..."

Lists two or more options which conflict. The "resolver" string is a (possibly unique) keyword which specifies which options to change when the constraint exists. When no resolver is provided, CUPS first tries the default choice followed by testing each option choice to resolve the conflict.

Examples:

    *% Specify that 2-sided printing cannot happen on transparencies
    *cupsUIConstraints transparency: "*Duplex *MediaType Transparency"

    *% Specify that envelope printing cannot happen from the paper trays
    *cupsUIConstraints envelope: "*PageSize Env10 *InputSlot Tray1"
    *cupsUIConstraints envelope: "*PageSize Env10 *InputSlot Tray1"
    *cupsUIConstraints envelope: "*PageSize EnvDL *InputSlot Tray2"
    *cupsUIConstraints envelope: "*PageSize EnvDL *InputSlot Tray2"

    *% Specify an installable option constraint for the envelope feeder
    *cupsUIConstraints: "*InputSlot EnvFeeder *InstalledEnvFeeder"

    *% Specify that photo printing cannot happen on plain paper or transparencies at 1200dpi
    *cupsUIConstraints photo: "*OutputMode Photo *MediaType Plain *Resolution 1200dpi"
    *cupsUIConstraints photo: "*OutputMode Photo *MediaType Transparency *Resolution 1200dpi"

### CUPS 1.4/macOS 10.6 cupsUIResolver

*cupsUIResolver resolver: "*Keyword1 OptionKeyword1 *Keyword2 OptionKeyword2 ..."

Specifies two or more options to mark/select to resolve a constraint. The "resolver" string identifies a particular action to take for one or more `cupsUIConstraints`. The same action can be used for multiple constraints. The option keyword pairs are treated as an ordered list of option selections to try - only the first N selections will be used, where N is the minimum number of selections required. Because `cupsResolveConflicts()` will not change the most recent option selection passed to it, at least two options from the constraints must be listed to avoid situations where conflicts cannot be resolved.

Examples:

    *% Specify the options to change for the 2-sided transparency constraint
    *cupsUIResolver transparency: "*Duplex None *MediaType Plain"

    *% Specify the options to change for the envelope printing constraints.  Notice
    *% that we try to change the InputSlot to either the envelope feeder or the
    *% manual feed first, then we change the page size...
    *cupsUIResolver envelope: "*InputSlot EnvFeeder *InputSlot ManualFeed *PageSize Letter"

    *% Specify the options to change for the photo printing constraints
    *cupsUIResolver photo: "*OutputMode Best *Resolution 600dpi"

## Globalized PPD Support

CUPS 1.2 and higher adds support for PPD files containing multiple languages by following the following additional rules:

1. The `LanguageVersion` MUST be `English`
2. The `LanguageEncoding` MUST be `ISOLatin1`
3. The `cupsLanguages` keyword MUST be provided and list each of the supported locales in the PPD file
4. Main and option keywords MUST NOT exceed 34 (instead of 40) characters to allow room for the locale prefixes in translation keywords
5. The main keyword "Translation" MUST NOT be used
6. Translation strings included with the main and option keywords MUST NOT contain characters outside the ASCII subset of ISOLatin1 and UTF-8; developers wishing to use characters outside ASCII MUST provide a separate set of English localization keywords for the affected keywords.
7. Localizations are specified using a locale prefix of the form "ll" or "ll_CC." where "ll" is the 2-letter ISO language code and "CC" is the 2-letter ISO country code
   - A generic language translation ("ll") SHOULD be provided with country-specific differences ("ll_CC") provided only as needed
   - For historical reasons, the "zh" and "zh_CN" locales map to Simplified Chinese while the "zh_TW" locale maps to Traditional Chinese
8. Locale-specific translation strings MUST be encoded using UTF-8.
9. Main keywords MUST be localized using one of the following forms:

   `*ll.Translation MainKeyword/translation text: ""`
   `*ll_CC.Translation MainKeyword/translation text: ""`

10. Option keywords MUST be localized using one of the following forms:

    `*ll.MainKeyword OptionKeyword/translation text: ""`
    `*ll_CC.MainKeyword OptionKeyword/translation text: ""`

11. Localization keywords MAY appear anywhere after the first line of the PPD file

> Note:

> We use a `LanguageEncoding` value of `ISOLatin1` and limit the allowed base translation strings to ASCII to avoid character coding issues that would otherwise occur. In addition, requiring the base translation strings to be in English allows for easier fallback translation when no localization is provided in the PPD file for a given locale.

Examples:

    *LanguageVersion: English
    *LanguageEncoding: ISOLatin1
    *cupsLanguages: "de fr_CA"
    *ModelName: "Foobar Laser 9999"

    *% Localize ModelName for French and German
    *fr_CA.Translation ModelName/La Foobar Laser 9999: ""
    *de.Translation ModelName/Foobar LaserDrucken 9999: ""

    *cupsIPPReason com.vendor-error/A serious error occurred: "/help/com.vendor/error.html"
    *% Localize printer-state-reason for French and German
    *fr_CA.cupsIPPReason com.vendor-error/Une erreur sèrieuse s'est produite: "/help/com.vendor/error.html"
    *de.cupsIPPReason com.vendor-error/Eine ernste Störung trat: "/help/com.vendor/error.html"

    ...

    *OpenUI *InputSlot/Paper Source: PickOne
    *OrderDependency: 10 AnySetup *InputSlot
    *DefaultInputSlot: Auto
    *% Localize InputSlot for French and German
    *fr_CA.Translation InputSlot/Papier source: ""
    *de.Translation InputSlot/Papiereinzug: ""
    *InputSlot Auto/Default: "<</ManualFeed false>>setpagedevice"
    *% Localize InputSlot=Auto for French and German
    *fr_CA.InputSlot Auto/Par Defaut: ""
    *de.InputSlot Auto/Standard: ""
    *InputSlot Manual/Manual Feed: "<</ManualFeed true>>setpagedevice"
    *% Localize InputSlot=Manual for French and German
    *fr_CA.InputSlot Manual/Manuel mecanisme de alimentation: ""
    *de.InputSlot Manual/Manueller Einzug: ""
    *CloseUI: *InputSlot

## CUPS 1.3/macOS 10.6Custom Options

CUPS supports custom options using an extension of the `CustomPageSize` and `ParamCustomPageSize` syntax:

    *CustomFoo True: "command"
    *ParamCustomFoo Name1/Text 1: order type minimum maximum
    *ParamCustomFoo Name2/Text 2: order type minimum maximum
    ...
    *ParamCustomFoo NameN/Text N: order type minimum maximum

When the base option is part of the `JCLSetup` section, the "command" string contains JCL commands with "\order" placeholders for each numbered parameter. The CUPS API handles any necessary value quoting for HP-PJL commands. For example, if the JCL command string is "@PJL SET PASSCODE=\1" and the first option value is "1234" then CUPS will output the string "@PJL SET PASSCODE=1234".

For non-`JCLSetup` options, the "order" value is a number from 1 to N and specifies the order of values as they are placed on the stack before the command. For example, if the PostScript command string is "<</cupsReal1 2 1 roll>>setpagedevice" and the option value is "2.0" then CUPS will output the string "2.0 <</cupsReal1 2 1 roll>>setpagedevice".

The "type" is one of the following keywords:

- `curve` - a real value from "minimum" to "maximum" representing a gamma correction curve using the function: f(x) = x value
- `int` - an integer value from "minimum" to "maximum"
- `invcurve` - a real value from "minimum" to "maximum" representing a gamma correction curve using the function: f(x) = x 1 / value
- `passcode` - a string of numbers value with a minimum of "minimum" numbers and a maximum of "maximum" numbers ("minimum" and "maximum" are numbers and passcode strings are not displayed in the user interface)
- `password` - a string value with a minimum of "minimum" characters and a maximum of "maximum" characters ("minimum" and "maximum" are numbers and password strings are not displayed in the user interface)
- `points` - a measurement value in points from "minimum" to "maximum"
- `real` - a real value from "minimum" to "maximum"
- `string` - a string value with a minimum of "minimum" characters and a maximum of "maximum" characters ("minimum" and "maximum" are numbers)

Examples:

    *% Base JCL key code option
    *JCLOpenUI JCLPasscode/Key Code: PickOne
    *OrderDependency: 10 JCLSetup *JCLPasscode
    *DefaultJCLPasscode: None
    *JCLPasscode None/No Code: ""
    *JCLPasscode 1111: "@PJL SET PASSCODE = 1111<0A>"
    *JCLPasscode 2222: "@PJL SET PASSCODE = 2222<0A>"
    *JCLPasscode 3333: "@PJL SET PASSCODE = 3333<0A>"
    *JCLCloseUI: *JCLPasscode

    *% Custom JCL key code option
    *CustomJCLPasscode True: "@PJL SET PASSCODE = \1<0A>"
    *ParamCustomJCLPasscode Code/Key Code: 1 passcode 4 4

    *% Base PostScript watermark option
    *OpenUI WatermarkText/Watermark Text: PickOne
    *OrderDependency: 10 AnySetup *WatermarkText
    *DefaultWatermarkText: None
    *WatermarkText None: ""
    *WatermarkText Draft: "<</cupsString1(Draft)>>setpagedevice"
    *CloseUI: *WatermarkText

    *% Custom PostScript watermark option
    *CustomWatermarkText True: "<</cupsString1 3 -1 roll>>setpagedevice"
    *ParamCustomWatermarkText Text: 1 string 0 32

    *% Base PostScript gamma/density option
    *OpenUI GammaDensity/Gamma and Density: PickOne
    *OrderDependency: 10 AnySetup *GammaDensity
    *DefaultGammaDensity: Normal
    *GammaDensity Normal/Normal: "<</cupsReal1 1.0/cupsReal2 1.0>>setpagedevice"
    *GammaDensity Light/Lighter: "<</cupsReal1 0.9/cupsReal2 0.67>>setpagedevice"
    *GammaDensity Dark/Darker: "<</cupsReal1 1.1/cupsReal2 1.5>>setpagedevice"
    *CloseUI: *GammaDensity

    *% Custom PostScript gamma/density option
    *CustomGammaDensity True: "<</cupsReal1 3 -1 roll/cupsReal2 5 -1>>setpagedevice"
    *ParamCustomGammaDensity Gamma: 1 curve 0.1 10
    *ParamCustomGammaDensity Density: 2 real 0 2

## Writing PostScript Option Commands for Raster Drivers

PPD files are used for both PostScript and non-PostScript printers. For CUPS raster drivers, you use a subset of the PostScript language to set page device keywords such as page size, resolution, and so forth. For example, the following code sets the page size to A4 size:

    *PageSize A4: "<</PageSize[595 842]>>setpagedevice"

Custom options typically use other operators to organize the values into a key/value dictionary for `setpagedevice`. For example, our previous `CustomWatermarkText` option code uses the `roll` operator to move the custom string value into the dictionary for `setpagedevice`:

    *CustomWatermarkText True: "<</cupsString1 3 -1 roll>>setpagedevice"

For a custom string value of "My Watermark", CUPS will produce the following PostScript code for the option:

    (My Watermark)
    <</cupsString1 3 -1 roll>>setpagedevice

The code moves the string value ("My Watermark") from the bottom of the stack to the top, creating a dictionary that looks like:

    <</cupsString1(My Watermark)>>setpagedevice

The resulting dictionary sets the page device attributes that are sent to your raster driver in the page header.

### Custom Page Size Code

There are many possible implementations of the `CustomPageSize` code. For CUPS raster drivers, the following code is recommended:

    *ParamCustomPageSize Width:        1 points min-width max-width
    *ParamCustomPageSize Height:       2 points min-height max-height
    *ParamCustomPageSize WidthOffset:  3 points 0 0
    *ParamCustomPageSize HeightOffset: 4 points 0 0
    *ParamCustomPageSize Orientation:  5 int 0 0
    *CustomPageSize True: "pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice"

### Supported PostScript Operators

CUPS supports the following PostScript operators in addition to the usual PostScript number, string (literal and hex-encoded), boolean, null, and name values:

- `<<` - Start a dictionary.
- `>>` - End a dictionary.
- `[` - Start an array.
- `]` - End an array.
- `copy` - Copy the top N objects on the stack.
- `dup` - Copy the top object on the stack.
- `index` - Copy the Nth from the top object on the stack.
- `pop` - Pop the top object on the stack.
- `roll` - Shift the top N objects on the stack.
- `setpagedevice` - Set the page header values according to the key/value dictionary on the stack.

> Note:

> Never use the unsupported `dict` or `put` operators in your option code. These operators are typically used in option code dating back to Level 1 PostScript printers, which did not support the simpler `<<` or `>>` operators. If you have old option code using `dict` or `put`, you can rewrite it very easily to use the newer `<<` and `>>` operators instead. For example, the following code to set the page size:

>     1 dict dup /PageSize [612 792] put setpagedevice

> can be rewritten as:

>     << /PageSize [612 792] >> setpagedevice

### Supported Page Device Attributes

Table 2 shows the supported page device attributes along with PostScript code examples.

Table 2: Supported Page Device Attributes
Name(s) | Type | Description | Example(s)
--- | --- | --- | ---
`AdvanceDistance` | Integer | Specifies the number of points to advance roll media after printing. | `<</AdvanceDistance 18>>setpagedevice`
`AdvanceMedia` | Integer | Specifies when to advance the media: 0 = never, 1 = after the file, 2 = after the job, 3 = after the set, and 4 = after the page. | `<</AdvanceMedia 4>>setpagedevice`
`Collate` | Boolean | Specifies whether collated copies are required. | `<</Collate true>>setpagedevice`
`CutMedia` | Integer | Specifies when to cut the media: 0 = never, 1 = after the file, 2 = after the job, 3 = after the set, and 4 = after the page. | `<</CutMedia 1>>setpagedevice`
`Duplex` | Boolean | Specifies whether 2-sided printing is required. | `<</Duplex true>>setpagedevice`
`HWResolution` | Integer Array | Specifies the resolution of the page image in pixels per inch. | `<</HWResolution[1200 1200]>>setpagedevice`
`InsertSheet` | Boolean | Specifies whether to insert a blank sheet before the job. | `<</InsertSheet true>>setpagedevice`
`Jog` | Integer | Specifies when to shift the media in the output bin: 0 = never, 1 = after the file, 2 = after the job, 3 = after the set, and 4 = after the page. | `<</Jog 2>>setpagedevice`
`LeadingEdge` | Integer | Specifies the leading edge of the media: 0 = top, 1 = right, 2 = bottom, 3 = left. | `<</LeadingEdge 0>>setpagedevice`
`ManualFeed` | Boolean | Specifies whether media should be drawn from the manual feed tray. Note: The `MediaPosition` attribute is preferred over the `ManualFeed` attribute. | `<</ManualFeed true>>setpagedevice`
`MediaClass` | String | Specifies a named media. | `<</MediaClass (Invoices)>>setpagedevice`
`MediaColor` | String | Specifies the color of the media. | `<</MediaColor >>setpagedevice`
`MediaPosition` | Integer | Specifies the tray or source of the media. | `<</MediaPosition 12>>setpagedevice`
`MediaType` | String | Specifies the general media type. | `<</MediaType (Glossy)>>setpagedevice`
`MediaWeight` | Integer | Specifies the media weight in grams per meter2. | `<</MediaWeight 100>>setpagedevice`
`MirrorPrint` | Boolean | Specifies whether to flip the output image horizontally. | `<</MirrorPrint true>>setpagedevice`
`NegativePrint` | Boolean | Specifies whether to invert the output image. | `<</NegativePrint true>>setpagedevice`
`NumCopies` | Integer | Specifies the number of copies to produce of each page. | `<</NumCopies 100>>setpagedevice`
`Orientation` | Integer | Specifies the orientation of the output: 0 = portrait, 1 = landscape rotated counter-clockwise, 2 = upside-down, 3 = landscape rotated clockwise. | `<</Orientation 3>>setpagedevice`
`OutputFaceUp` | Boolean | Specifies whether to place the media face-up in the output bin/tray. | `<</OutputFaceUp true>>setpagedevice`
`OutputType` | String | Specifies the output type name. | `<</OutputType (Photo)>>setpagedevice`
`PageSize` | Integer/Real Array | Specifies the width and length/height of the page in points. | `<</PageSize[595 842]>>setpagedevice`
`Separations` | Boolean | Specifies whether to produce color separations. | `<</Separations true>>setpagedevice`
`TraySwitch` | Boolean | Specifies whether to switch trays automatically. | `<</TraySwitch true>>setpagedevice`
`Tumble` | Boolean | Specifies whether the back sides of pages are rotated 180 degrees. | `<</Tumble true>>setpagedevice`
`cupsBorderlessScalingFactor` | Real | Specifies the amount to scale the page image dimensions. | `<</cupsBorderlessScalingFactor 1.01>>setpagedevice`
`cupsColorOrder` | Integer | Specifies the order of colors: 0 = chunked, 1 = banded, 2 = planar. | `<</cupsColorOrder 0>>setpagedevice`
`cupsColorSpace` | Integer | Specifies the page image colorspace: 0 = W, 1 = RGB, 2 = RGBA, 3 = K, 4 = CMY, 5 = YMC, 6 = CMYK, 7 = YMCK, 8 = KCMY, 9 = KCMYcm, 10 = GMCK, 11 = GMCS, 12 = White, 13 = Gold, 14 = Silver, 15 = CIE XYZ, 16 = CIE Lab, 17 = RGBW, 32 to 46 = CIE Lab (1 to 15 inks) | `<</cupsColorSpace 1 >>setpagedevice`
`cupsCompression` | Integer | Specifies a driver compression type/mode. | `<</cupsCompression 2>>setpagedevice`
`cupsInteger0 ... cupsInteger15` | Integer | Specifies driver integer values. | `<</cupsInteger11 1234>>setpagedevice`
`cupsMarkerType` | String | Specifies the type of ink/toner to use. | `<</cupsMarkerType (Black+Color)>>setpagedevice`
`cupsMediaType` | Integer | Specifies a numeric media type. | `<</cupsMediaType 999>>setpagedevice`
`cupsPageSizeName` | String | Specifies the name of the page size. | `<</cupsPageSizeName (A4.Full)>>setpagedevice`
`cupsPreferredBitsPerColor` | Integer | Specifies the preferred number of bits per color, typically 8 or 16. | `<</cupsPreferredBitsPerColor 16>>setpagedevice`
`cupsReal0 ... cupsReal15` | Real | Specifies driver real number values. | `<</cupsReal15 1.234>>setpagedevice`
`cupsRenderingIntent` | String | Specifies the color rendering intent. | `<</cupsRenderingIntent (AbsoluteColorimetric)>>setpagedevice`
`cupsRowCount` | Integer | Specifies the number of rows of raster data to print on each line for some drivers. | `<</cupsRowCount 24>>setpagedevice`
`cupsRowFeed` | Integer | Specifies the number of rows to feed between passes for some drivers. | `<</cupsRowFeed 17>>setpagedevice`
`cupsRowStep` | Integer | Specifies the number of lines between columns/rows on the print head for some drivers. | `<</cupsRowStep 2>>setpagedevice`
`cupsString0 ... cupsString15` | String | Specifies driver string values. | `<</cupsString0(String Value)>>setpagedevice`

## Media Keywords

The CUPS media keywords allow drivers to specify alternate custom page size limits based on up to two options.

### CUPS 1.4/macOS 10.6 cupsMediaQualifier2

*cupsMediaQualifier2: MainKeyword

This keyword specifies the second option to use for overriding the custom page size limits.

Example:

    *% Specify alternate custom page size limits based on InputSlot and Quality
    *cupsMediaQualifier2: InputSlot
    *cupsMediaQualifier3: Quality
    *cupsMaxSize .Manual.: "1000 1000"
    *cupsMinSize .Manual.: "100 100"
    *cupsMinSize .Manual.Photo: "200 200"
    *cupsMinSize ..Photo: "300 300"

### CUPS 1.4/macOS 10.6 cupsMediaQualifier3

*cupsMediaQualifier3: MainKeyword

This keyword specifies the third option to use for overriding the custom page size limits.

Example:

    *% Specify alternate custom page size limits based on InputSlot and Quality
    *cupsMediaQualifier2: InputSlot
    *cupsMediaQualifier3: Quality
    *cupsMaxSize .Manual.: "1000 1000"
    *cupsMinSize .Manual.: "100 100"
    *cupsMinSize .Manual.Photo: "200 200"
    *cupsMinSize ..Photo: "300 300"

### CUPS 1.4/macOS 10.6 cupsMinSize

*cupsMinSize .Qualifier2.Qualifier3: "width length"
*cupsMinSize .Qualifier2.: "width length"
*cupsMinSize ..Qualifier3: "width length"

This keyword specifies alternate minimum custom page sizes in points. The `cupsMediaQualifier2` and `cupsMediaQualifier3` keywords are used to identify options to use for matching.

Example:

    *% Specify alternate custom page size limits based on InputSlot and Quality
    *cupsMediaQualifier2: InputSlot
    *cupsMediaQualifier3: Quality
    *cupsMaxSize .Manual.: "1000 1000"
    *cupsMinSize .Manual.: "100 100"
    *cupsMinSize .Manual.Photo: "200 200"
    *cupsMinSize ..Photo: "300 300"

### CUPS 1.4/macOS 10.6 cupsMaxSize

*cupsMaxSize .Qualifier2.Qualifier3: "width length"
*cupsMaxSize .Qualifier2.: "width length"
*cupsMaxSize ..Qualifier3: "width length"

This keyword specifies alternate maximum custom page sizes in points. The `cupsMediaQualifier2` and `cupsMediaQualifier3` keywords are used to identify options to use for matching.

Example:

    *% Specify alternate custom page size limits based on InputSlot and Quality
    *cupsMediaQualifier2: InputSlot
    *cupsMediaQualifier3: Quality
    *cupsMaxSize .Manual.: "1000 1000"
    *cupsMinSize .Manual.: "100 100"
    *cupsMinSize .Manual.Photo: "200 200"
    *cupsMinSize ..Photo: "300 300"

### CUPS 1.4/macOS 10.6 cupsPageSizeCategory

*cupsPageSizeCategory name/text: "name name2 ... nameN"

This keyword lists related paper size names that should be grouped together in the Print or Page Setup dialogs. The "name" portion of the keyword specifies the root/default size for the grouping. On macOS the grouped paper sizes are shown in a submenu of the main paper size. When omitted, sizes with the same dimensions are automatically grouped together, for example "Letter" and "Letter.Borderless".

Example:

    *% Specify grouping of borderless/non-borderless sizes
    *cupsPageSizeCategory Letter/US Letter: "Letter Letter.Borderless"
    *cupsPageSizeCategory A4/A4: "A4 A4.Borderless"

## General Attributes

### CUPS 1.3/macOS 10.5 cupsBackSide

*cupsBackSide: keyword

This keyword requests special handling of the back side of pages when doing duplexed (2-sided) output. Table 1 shows the supported keyword values for this keyword and their effect on the raster data sent to your driver. For example, when `cupsBackSide` is `Rotated` and `Tumble` is `false`, your driver will receive print data starting at the bottom right corner of the page, with each line going right-to-left instead of left-to-right. The default value is `Normal`.

> Note:

> `cupsBackSide` replaces the older `cupsFlipDuplex` keyword - if `cupsBackSide` is specified, `cupsFlipDuplex` will be ignored.

Table 1: Back Side Raster Coordinate System
cupsBackSide | Tumble Value | Image Presentation
--- | --- | ---
`Normal` | `false` | Left-to-right, top-to-bottom
`Normal` | `true` | Left-to-right, top-to-bottom
`ManualTumble` | `false` | Left-to-right, top-to-bottom
`ManualTumble` | `true` | Right-to-left, bottom-to-top
`Rotated` | `false` | Right-to-left, bottom-to-top
`Rotated` | `true` | Right-to-left, top-to-bottom
`Flipped` * | `false` | Left-to-right, bottom-to-top
`Flipped` * | `true` | Right-to-left, top-to-bottom

* - Not supported in macOS 10.5.x and earlier

Figure 1: Back side images

Examples:

    *% Flip the page image for the back side of duplexed output
    *cupsBackSide: Flipped

    *% Rotate the page image for the back side of duplexed output
    *cupsBackSide: Rotated

Also see the related `APDuplexRequiresFlippedMargin` keyword.

### CUPS 1.4/macOS 10.6 cupsCommands

*cupsCommands: "name name2 ... nameN"

This string keyword specifies the commands that are supported by the CUPS command file filter for this device. The command names are separated by whitespace.

Example:

    *% Specify the list of commands we support
    *cupsCommands: "AutoConfigure Clean PrintSelfTestPage ReportLevels com.vendor.foo"

### CUPS 1.3/macOS 10.5 cupsEvenDuplex

*cupsEvenDuplex: boolean

This boolean keyword notifies the RIP filters that the destination printer requires an even number of pages when 2-sided printing is selected. The default value is `false`.

Example:

    *% Always send an even number of pages when duplexing
    *cupsEvenDuplex: true

### cupsFax

*cupsFax: boolean

This boolean keyword specifies whether the PPD defines a facsimile device. The default is `false`.

Examples:

    *cupsFax: true

### cupsFilter

*cupsFilter: "source/type cost program"

This string keyword provides a conversion rule from the given source type to the printer's native format using the filter "program". If a printer supports the source type directly, the special filter program "-" may be specified.

Examples:

    *% Standard raster printer driver filter
    *cupsFilter: "application/vnd.cups-raster 100 rastertofoo"

    *% Plain text filter
    *cupsFilter: "text/plain 10 texttofoo"

    *% Pass-through filter for PostScript printers
    *cupsFilter: "application/vnd.cups-postscript 0 -"

### CUPS 1.5 cupsFilter2

*cupsFilter2: "source/type destination/type cost program"

This string keyword provides a conversion rule from the given source type to the printer's native format using the filter "program". If a printer supports the source type directly, the special filter program "-" may be specified. The destination type is automatically created as needed and is passed to the filters and backend as the FINAL_CONTENT_TYPE value.

> Note:

> The presence of a single `cupsFilter2` keyword in the PPD file will hide any `cupsFilter` keywords from the CUPS scheduler. When using `cupsFilter2` to provide filters specific for CUPS 1.5 and later, provide a `cupsFilter2` line for every filter and a `cupsFilter` line for each filter that is compatible with older versions of CUPS.

Examples:

    *% Standard raster printer driver filter
    *cupsFilter2: "application/vnd.cups-raster application/vnd.foo 100 rastertofoo"

    *% Plain text filter
    *cupsFilter2: "text/plain application/vnd.foo 10 texttofoo"

    *% Pass-through filter for PostScript printers
    *cupsFilter2: "application/vnd.cups-postscript application/postscript 0 -"

### CUPS 2.3 cupsFinishingTemplate

*cupsFinishingTemplate name/text: ""

This option keyword specifies a finishing template (preset) that applies zero or more finishing processes to a job. Unlike `cupsIPPFinishings`, only one template can be selected by the user. PPD files also generally apply a constraint between this option and other finishing options like `Booklet`, `FoldType`, `PunchMedia`, and `StapleWhen`.

Examples:

    *cupsFinishingTemplate none/None: ""
    *cupsFinishingTemplate fold/Letter Fold: ""
    *cupsFinishingTemplate punch/2/3-Hole Punch: ""
    *cupsFinishingTemplate staple/Corner Staple: ""
    *cupsFinishingTemplate staple-dual/Double Staple: ""
    *cupsFinishingTemplate staple-and-fold/Corner Staple and Letter Fold: ""
    *cupsFinishingTemplate staple-and-punch/Corner Staple and 2/3-Hole Punch: ""

### Deprecated cupsFlipDuplex

*cupsFlipDuplex: boolean

Due to implementation differences between macOS and Ghostscript, the `cupsFlipDuplex` keyword is deprecated. Instead, use the `cupsBackSide` keyword to specify the coordinate system (pixel layout) of the page data on the back side of duplex pages.

The value `true` maps to a `cupsBackSide` value of `Rotated` on macOS and `Flipped` with Ghostscript.

The default value is `false`.

> Note:

> macOS drivers that previously used `cupsFlipDuplex` may wish to provide both the old and new keywords for maximum compatibility, for example:

>     *cupsBackSide: Rotated
>     *cupsFlipDuplex: true

> Similarly, drivers written for other operating systems using Ghostscript can use:

>     *cupsBackSide: Flipped
>     *cupsFlipDuplex: true

### CUPS 1.3/macOS 10.5 cupsIPPFinishings

*cupsIPPFinishings number/text: "*Option Choice ..."

This keyword defines a mapping from IPP `finishings` values to PPD options and choices.

Examples:

    *cupsIPPFinishings 4/staple: "*StapleLocation SinglePortrait"
    *cupsIPPFinishings 5/punch: "*PunchMedia Yes *PunchLocation LeftSide"
    *cupsIPPFinishings 20/staple-top-left: "*StapleLocation SinglePortrait"
    *cupsIPPFinishings 21/staple-bottom-left: "*StapleLocation SingleLandscape"

### CUPS 1.3/macOS 10.5 cupsIPPReason

*cupsIPPReason reason/Reason Text: "optional URIs"

This optional keyword maps custom `printer-state-reasons` keywords that are generated by the driver to human readable text. The optional URIs string contains zero or more URIs separated by a newline. Each URI can be a CUPS server absolute path to a help file under the scheduler's `DocumentRoot` directory, a full HTTP URL ("http://www.domain.com/path/to/help/page.html"), or any other valid URI which directs the user at additional information concerning the condition that is being reported.

Since the reason text is limited to 80 characters by the PPD specification, longer text strings can be included by URI-encoding the text with the "text" scheme, for example "text:some%20text". Multiple `text` URIs are combined by the `ppdLocalizeIPPReason` into a single string that can be displayed to the user.

Examples:

    *% Map com.vendor-error to text but no page
    *cupsIPPReason com.vendor-error/A serious error occurred: ""

    *% Map com.vendor-error to more than 80 characters of text but no page
    *cupsIPPReason com.vendor-error/A serious error occurred: "text:Now%20is%20the%20time
    text:for%20all%20good%20men%20to%20come%20to%20the%20aid%20of%20their%20country."

    *% Map com.vendor-error to text and a local page
    *cupsIPPReason com.vendor-error/A serious error occurred: "/help/com.vendor/error.html"

    *% Map com.vendor-error to text and a remote page
    *cupsIPPReason com.vendor-error/A serious error occurred: "http://www.vendor.com/help"

    *% Map com.vendor-error to text and a local, Apple help book, and remote page
    *APHelpBook: "file:///Library/Printers/vendor/Help.bundle"
    *cupsIPPReason com.vendor-error/A serious error occurred: "/help/com.vendor/error.html
    help:anchor='com.vendor-error'%20bookID=Vendor%20Help
    http://www.vendor.com/help"
    *End

### CUPS 1.5 cupsIPPSupplies

*cupsIPPSupplies: boolean

This keyword tells the IPP backend whether it should report the current marker-xxx supply attribute values. The default value is `True`.

Example:

    *% Do not use IPP marker-xxx attributes to report supply levels
    *cupsIPPSupplies: False

### CUPS 1.7/macOS 10.9 cupsJobAccountId

*cupsJobAccountId: boolean

This keyword defines whether the printer accepts the job-account-id IPP attribute.

Example:

    *% Specify the printer accepts the job-account-id IPP attribute.
    *cupsJobAccountId: True

### CUPS 1.7/macOS 10.9 cupsJobAccountingUserId

*cupsJobAccountingUserId: boolean

This keyword defines whether the printer accepts the job-accounting-user-id IPP attribute.

Example:

    *% Specify the printer accepts the job-accounting-user-id IPP attribute.
    *cupsJobAccountingUserId: True

### CUPS 1.7/macOS 10.9 cupsJobPassword

*cupsJobPassword: "format"

This keyword defines the format of the "job-password" IPP attribute, if supported by the printer. The following format characters are supported:

- `1`: US ASCII digits.
- `A`: US ASCII letters.
- `C`: US ASCII letters, numbers, and punctuation.
- `.`: Any US ASCII printable character (0x20 to 0x7e).
- `N`: Any Unicode digit character.
- `U`: Any Unicode letter character.
- `*`: Any Unicode (utf-8) character.

The format characters are repeated to indicate the length of the password string. For example, "1111" indicated a 4-digit US ASCII PIN code.

Example:

    *% Specify the printer supports 4-digit PIN codes.
    *cupsJobPassword: "1111"

### CUPS 1.2/macOS 10.5 cupsLanguages

*cupsLanguages: "locale list"

This keyword describes which language localizations are included in the PPD. The "locale list" string is a space-delimited list of locale names ("en", "en_US", "fr_CA", etc.)

Example:

    *% Specify Canadian, UK, and US English, and Canadian and French French
    *cupsLanguages: "en_CA en_UK en_US fr_CA fr_FR"

### CUPS 1.7/macOS 10.9 cupsMandatory

*cupsMandatory: "attribute1 attribute2 ... attributeN"

This keyword defines a list of IPP attributes that must be provided when submitting a print job creation request.

Example:

    *% Specify that the user must supply a job-password
    *cupsMandatory: "job-password job-password-encryption"

### cupsManualCopies

*cupsManualCopies: boolean

This boolean keyword notifies the RIP filters that the destination printer does not support copy generation in hardware. The default value is `false`.

Example:

    *% Tell the RIP filters to generate the copies for us
    *cupsManualCopies: true

### CUPS 1.4/macOS 10.6 cupsMarkerName

*cupsMarkerName/Name Text: ""

This optional keyword maps `marker-names` strings that are generated by the driver to human readable text.

Examples:

    *% Map cyanToner to "Cyan Toner"
    *cupsMarkerName cyanToner/Cyan Toner: ""

### CUPS 1.4/macOS 10.6 cupsMarkerNotice

*cupsMarkerNotice: "disclaimer text"

This optional keyword provides disclaimer text for the supply level information provided by the driver, typically something like "supply levels are approximate".

Examples:

    *cupsMarkerNotice: "Supply levels are approximate."

### CUPS 1.6/macOS 10.8 cupsMaxCopies

*cupsMaxCopies: integer

This integer keyword notifies the filters that the destination printer supports up to N copies in hardware. The default value is `9999`.

Example:

    *% Tell the RIP filters we can do up to 99 copies
    *cupsMaxCopies: 99

### cupsModelNumber

*cupsModelNumber: number

This integer keyword specifies a printer-specific model number. This number can be used by a filter program to adjust the output for a specific model of printer.

Example:

    *% Specify an integer for a driver-specific model number
    *cupsModelNumber: 1234

### CUPS 1.3/macOS 10.5 cupsPJLCharset

*cupsPJLCharset: "ISO character set name"

This string keyword specifies the character set that is used for strings in PJL commands. If not specified, US-ASCII is assumed.

Example:

    *% Specify UTF-8 is used in PJL strings
    *cupsPJLCharset: "UTF-8"

### CUPS 1.4/macOS 10.6 cupsPJLDisplay

*cupsPJLDisplay: "what"

This optional keyword specifies which command is used to display the job ID, name, and user on the printer's control panel. "What" is either "none" to disable this functionality, "job" to use "@PJL JOB DISPLAY", or "rdymsg" to use "@PJL RDYMSG DISPLAY". The default is "job".

Examples:

    *% Display job information using @PJL SET RDYMSG DISPLAY="foo"
    *cupsPJLDisplay: "rdymsg"

    *% Display job information display
    *cupsPJLDisplay: "none"

### CUPS 1.2/macOS 10.5 cupsPortMonitor

*cupsPortMonitor urischeme/Descriptive Text: "port monitor"

This string keyword specifies printer-specific "port monitor" filters that may be used with the printer. The CUPS scheduler also looks for the `Protocols` keyword to see if the `BCP` or `TBCP` protocols are supported. If so, the corresponding port monitor ("bcp" and "tbcp", respectively) is listed in the printer's `port-monitor-supported` keyword.

The "urischeme" portion of the keyword specifies the URI scheme that this port monitor should be used for. Typically this is used to pre-select a particular port monitor for each type of connection that is supported by the printer. The "port monitor" string can be "none" to disable the port monitor for the given URI scheme.

Examples:

    *% Specify a PostScript printer that supports the TBCP protocol
    *Protocols: TBCP PJL

    *% Specify that TBCP should be used for socket connections but not USB
    *cupsPortMonitor socket/AppSocket Printing: "tbcp"
    *cupsPortMonitor usb/USB Printing: "none"

    *% Specify a printer-specific port monitor for an Epson USB printer
    *cupsPortMonitor usb/USB Status Monitor: "epson-usb"

### CUPS 1.3/macOS 10.5 cupsPreFilter

*cupsPreFilter: "source/type cost program"

This string keyword provides a pre-filter rule. The pre-filter program will be inserted in the conversion chain immediately before the filter that accepts the given MIME type.

Examples:

    *% PDF pre-filter
    *cupsPreFilter: "application/pdf 100 mypdfprefilter"

    *% PNG pre-filter
    *cupsPreFilter: "image/png 0 mypngprefilter"

### CUPS 1.5 cupsPrintQuality

*cupsPrintQuality keyword/text: "code"

This UI keyword defines standard print qualities that directly map from the IPP "print-quality" job template keyword. Standard keyword values are "Draft", "Normal", and "High" which are mapped from the IPP "print-quality" values 3, 4, and 5 respectively. Each `cupsPrintQuality` option typically sets output mode and resolution parameters in the page device dictionary, eliminating the need for separate (and sometimes confusing) output mode and resolution options.

> Note:

> Unlike all of the other keywords defined in this document, `cupsPrintQuality` is a UI keyword that MUST be enclosed inside the PPD `OpenUI` and `CloseUI` keywords.

Examples:

    *OpenUI *cupsPrintQuality/Print Quality: PickOne
    *OrderDependency: 10 AnySetup *cupsPrintQuality
    *DefaultcupsPrintQuality: Normal
    *cupsPrintQuality Draft/Draft: "code"
    *cupsPrintQuality Normal/Normal: "code"
    *cupsPrintQuality High/Photo: "code"
    *CloseUI: *cupsPrintQuality

### CUPS 1.5 cupsSingleFile

*cupsSingleFile: Boolean

This boolean keyword tells the scheduler whether to print multiple files in a job together or singly. The default is "False" which uses a single instance of the backend for all files in the print job. Setting this keyword to "True" will result in separate instances of the backend for each file in the print job.

Examples:

    *% Send all print data to a single backend
    *cupsSingleFile: False

    *% Send each file using a separate backend
    *cupsSingleFile: True

### CUPS 1.4/macOS 10.6 cupsSNMPSupplies

*cupsSNMPSupplies: boolean

This keyword tells the standard network backends whether they should query the standard SNMP Printer MIB OIDs for supply levels. The default value is `True`.

Example:

    *% Do not use SNMP queries to report supply levels
    *cupsSNMPSupplies: False

### cupsVersion

*cupsVersion: major.minor

This required keyword describes which version of the CUPS PPD file extensions was used. Currently it must be the string "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", or "1.6".

Example:

    *% Specify a CUPS 1.2 driver
    *cupsVersion: "1.2"

### CUPS 1.6/macOS 10.8 JCLToPDFInterpreter

*JCLToPDFInterpreter: "JCL"

This keyword provides the JCL command to insert a PDF job file into a printer-ready data stream. The JCL command is added after the `JCLBegin` value and any commands for JCL options in the PPD file.

Example:

    *% PJL command to start the PDF interpreter
    *JCLToPDFInterpreter: "@PJL ENTER LANGUAGE = PDF<0A>"

## macOS Attributes

### Deprecated APDialogExtension

*APDialogExtension: "/Library/Printers/vendor/filename.plugin"

This keyword defines additional option panes that are displayed in the print dialog. Each keyword adds one or more option panes. See the "OutputBinsPDE" example and Apple Technical Q&A QA1352 for information on writing your own print dialog plug-ins.

> Note:

> Since 2010, AirPrint has enabled the printing of full quality photos and documents from the Mac without requiring driver software. Starting with macOS 10.12, system level security features prevent print dialog plug-ins from being loaded into applications that have enabled the library validation security feature. As of macOS 10.14 the `APDialogExtension` attribute used to create macOS print drivers is deprecated. All new printer models should support AirPrint moving forward.

Examples:

    *% Add two panes for finishing and driver options
    *APDialogExtension: "/Library/Printers/vendor/finishing.plugin"
    *APDialogExtension: "/Library/Printers/vendor/options.plugin"

### macOS 10.4 APDuplexRequiresFlippedMargin

*APDuplexRequiresFlippedMargin: boolean

This boolean keyword notifies the RIP filters that the destination printer requires the top and bottom margins of the `ImageableArea` to be swapped for the back page. The default is `true` when `cupsBackSide` is `Flipped` and `false` otherwise. Table 2 shows how `APDuplexRequiresFlippedMargin` interacts with `cupsBackSide` and the `Tumble` page attribute.

Table 2: Margin Flipping Modes
APDuplexRequiresFlippedMargin | cupsBackSide | Tumble Value | Margins
--- | --- | --- | ---
false | any | any | Normal
any | Normal | any | Normal
true | ManualDuplex | false | Normal
true | ManualDuplex | true | Flipped
true | Rotated | false | Flipped
true | Rotated | true | Normal
true or unspecified | Flipped | any | Flipped

Example:

    *% Rotate the back side images
    *cupsBackSide: Rotated

    *% Don't swap the top and bottom margins for the back side
    *APDuplexRequiresFlippedMargin: false

Also see the related `cupsBackSide` keyword.

### APHelpBook

*APHelpBook: "bundle URL"

This string keyword specifies the Apple help book bundle to use when looking up IPP reason codes for this printer driver. The `cupsIPPReason` keyword maps "help" URIs to this file.

Example:

    *APHelpBook: "file:///Library/Printers/vendor/Help.bundle"

### macOS 10.6 APICADriver

*APICADriver: boolean

This keyword specifies whether the device has a matching Image Capture Architecture (ICA) driver for scanning. The default is `False`.

Examples:

    *APICADriver: True
    *APScanAppBundleID: "com.apple.ImageCaptureApp"

### macOS 10.3 APPrinterIconPath

*APPrinterIconPath: "/Library/Printers/vendor/filename.icns"

This keyword defines the location of a printer icon file to use when displaying the printer. The file must be in the Apple icon format.

Examples:

    *% Apple icon file
    *APPrinterIconPath: "/Library/Printers/vendor/Icons/filename.icns"

### macOS 10.4 APPrinterLowInkTool

*APPrinterLowInkTool: "/Library/Printers/vendor/program"

This keyword defines an program that checks the ink/toner/marker levels on a printer, returning an XML document with those levels. See the "InkTool" example and Apple Technical Note TN2144 for more information.

Examples:

    *% Use a vendor monitoring program
    *APPrinterLowInkTool: "/Library/Printers/vendor/Tools/lowinktool"

### macOS 10.5 APPrinterPreset

*APPrinterPreset name/text: "*Option Choice ..."

This keyword defines presets for multiple options that show up in the print dialog of applications (such as iPhoto) that set the job style hint to `NSPrintPhotoJobStyleHint`. Each preset maps to one or more pairs of PPD options and choices as well as providing key/value data for the application. The following standard preset names are currently defined:

- `General_with_Paper_Auto-Detect`; Normal quality general printing with auto-detected media.
- `General_with_Paper_Auto-Detect_-_Draft`; Draft quality general printing with auto-detected media.
- `General_on_Plain_Paper`; Normal quality general printing on plain paper.
- `General_on_Plain_Paper_-_Draft`; Draft quality general printing on plain paper.
- `Photo_with_Paper_Auto-Detect`; Normal quality photo printing with auto-detected media.
- `Photo_with_Paper_Auto-Detect_-_Fine`; High quality photo printing with auto-detected media.
- `Photo_on_Plain_Paper`; Normal quality photo printing on plain paper.
- `Photo_on_Plain_Paper_-_Fine`; High quality photo printing on plain paper.
- `Photo_on_Photo_Paper`; Normal quality photo printing on glossy photo paper.
- `Photo_on_Photo_Paper_-_Fine`; High quality photo printing on glossy photo paper.
- `Photo_on_Matte_Paper`; Normal quality photo printing on matte paper.
- `Photo_on_Matte_Paper_-_Fine`; High quality photo printing on matte paper.

The value string consists of pairs of keywords, either an option name and choice (*MainKeyword OptionKeyword) or a preset identifier and value (com.apple.print.preset.foo value). The following preset identifiers are currently used:

- `com.apple.print.preset.graphicsType`; specifies the type of printing used for this printing - "General" for general purpose printing and "Photo" for photo printing.
- `com.apple.print.preset.media-front-coating`; specifies the media type selected by this preset - "none" (plain paper), "glossy", "high-gloss", "semi-gloss", "satin", "matte", and "autodetect".
- `com.apple.print.preset.output-mode`; specifies the output mode for this preset - "color" (default for color printers) or "monochrome" (grayscale, default for B&W printers).
- `com.apple.print.preset.quality`; specifies the overall print quality selected by this preset - "low" (draft), "mid" (normal), or "high".

Presets, like options, can also be localized in multiple languages.

Examples:

    *APPrinterPreset Photo_on_Photo_Paper/Photo on Photo Paper: "
      *MediaType Glossy
      *ColorModel RGB
      *Resolution 300dpi
      com.apple.print.preset.graphicsType Photo
      com.apple.print.preset.quality mid
      com.apple.print.preset.media-front-coating glossy"
    *End
    *fr.APPrinterPreset Photo_on_Photo_Paper/Photo sur papier photographique: ""

### macOS 10.3 APPrinterUtilityPath

*APPrinterPrinterUtilityPath: "/Library/Printers/vendor/filename.app"

This keyword defines a GUI application that can be used to do printer maintenance functions such as cleaning the print head(s). See ... for more information.

Examples:

    *% Define the printer utility application
    *APPrinterPrinterUtilityPath: "/Library/Printers/vendor/Tools/utility.app"

### macOS 10.6 APScannerOnly

*APScannerOnly: boolean

This keyword specifies whether the device has scanning but no printing capabilities. The default is `False`.

Examples:

    *APICADriver: True
    *APScannerOnly: True

### macOS 10.3 APScanAppBundleID

*APScanAppBundleID: "bundle ID"

This keyword defines the application to use when scanning pages from the device.

Examples:

    *APICADriver: True
    *APScanAppBundleID: "com.apple.ImageCaptureApp"

## Change History

### Changes in CUPS 2.3

- Added `cupsFinishingTemplate` option.

### Changes in CUPS 1.7

- Added `cupsJobAccountId`, `cupsJobAccountingUserId`, `cupsJobPassword`, `cupsMandatory` keywords.

### Changes in CUPS 1.6

- Added `cupsPageSizeCategory` keyword (originally defined in CUPS 1.4).
- Added `cupsMaxCopies` keyword.
- Documented `JCLToPDFInterpreter` keyword.
- Updated `cupsVersion` keyword documentation to list all current releases of CUPS.

### Changes in CUPS 1.5

- Changes all instances of PPD attributes to PPD keywords, to be consistent with the parent specification from Adobe.

### Changes in CUPS 1.4.5

- Added `cupsPrintQuality` UI keyword.
- Added new properties and values for the `APPrinterPreset` keyword.

### Changes in CUPS 1.4

- Added `APICADriver` keyword.
- Added `cupsCommands` keyword.
- Added `cupsMarkerName` keyword.
- Added `cupsMarkerNotice` keyword.
- Added `cupsPJLDisplay` keyword.
- Added `cupsSNMPSupplies` keyword.
- Added `cupsUIResolver` and `cupsUIConstraints` keywords.
- Added `cupsMediaQualifier2`, `cupsMediaQualifier3`, `cupsMinSize`, and `cupsMaxSize` keywords.

### Changes in CUPS 1.3.1

- Added missing macOS `AP` keywords.
- Added section on auto-configuration including the `OIDMainKeyword` and `?MainKeyword` keywords.
- Minor reorganization.

### Changes in CUPS 1.3

- Added `cupsBackSide` and deprecated `cupsFlipDuplex`.
- Added text URI information to `cupsIPPReason` documentation.
- Added `APPrinterPreset`, `cupsIPPFinishings`, and `cupsPreFilter` keywords.
- Added discussion of custom option code, sample `CustomPageSize` code, and "do not use dict and put" note.

### Changes in CUPS 1.2.8

- Added section on supported PostScript commands for raster drivers

### Changes in CUPS 1.2

- Added globalization support keywords
- Added custom option values support
- Added `APHelpBook` keyword
- Added `APDuplexRequiresFlippedMargin` keyword
- Added `cupsICCProfile` keyword
- Added `cupsIPPReason` keyword
- Added `cupsLanguages` keyword
- Added `cupsPortMonitor` keyword
- Removed `cupsProtocol` keyword

### Changes in CUPS 1.1

- Added `cupsFlipDuplex` keyword
- Added `cupsProtocol` keyword