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 [RFC2234] defines the general format of lines in a PPD
file:
This attribute defines a program that sets the default option choices. It
is run when a printer is added from the printer browser instead of the
normal PostScript query and SNMP OID attribute lookups.
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"
*?MainKeyword: "
PostScript query code that writes a message using the = operator...
"
*End
The ?MainKeyword attribute 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
The OIDMainKeyword attribute 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 attributes 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"
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 X. 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.
This string attribute specifies an sRGB-based color profile
consisting of gamma and density controls and a 3x3 CMY color
transform matrix.
The Resolution and MediaType values may be "-"
to act as a wildcard. Otherwise they must match one of the
Resolution or MediaType attributes 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"
This attribute specifies an ICC color profile that is
used to convert the document colors to the device
colorspace. The ColorModel, MediaType, and
Resolution 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 MediaType and Resolution keywords can be
reassigned to different main keywords, allowing drivers to do
color profile selection based on different parameters. The
cupsICCQualifier2 and cupsICCQualifier3
attributes define the mapping from selector to main keyword:
These attributes tell the Mac OS X 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 attributes specify alternate
color profiles (sRGB or AdobeRGB) to use for 3-color (RGB) raster data.
This attribute 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): ""
This attribute defines a supported RGB color profile that can be used
when doing custom color matching. Currently only sRGB and
AdobeRGB are supported. If not specified, RGB data will use the
Generic RGB colorspace.
Note:
If you provide multiple APCustomColorMatchingProfile attributes,
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
This attribute defines the default RGB color profile that will be used
when doing custom color matching. Currently only sRGB and
AdobeRGB are supported.
Examples:
*% Use sRGB for RGB color by default
*APSupportsCustomColorMatching: true
*APDefaultCustomColorMatchingProfile: sRGB
This attribute specifies that the driver provides its own custom color
matching. When true, the default hand-off colorspace will be
Generic Gray, Generic RGB, or Generic CMYK depending on the number of
components the driver requests. The APDefaultCustomColorMatchingProfile
attribute can be used to override the default 3-component (RGB) colorspace.
The default for APSupportsCustomColorMatching is false.
CUPS 1.2 and higher adds support for PPD files containing multiple
languages by following the following additional rules:
The LanguageVersion MUST be English
The LanguageEncoding MUST be ISOLatin1
The cupsLanguages attribute MUST be provided and
list each of the supported locales in the PPD file
Main and option keywords MUST NOT exceed 34 (instead of 40)
characters to allow room for the locale prefixes in translation
attributes
The main keyword "Translation" MUST NOT be used
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 attributes for the affected keywords.
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
Locale-specific translation strings MUST be encoded
using UTF-8.
Main keywords MUST be localized using one of the
following forms:
Localization attributes 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 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)
Note:
Custom options are not directly supported by the Mac OS X Print Dialog
nor by the CUPS web interface at this time. Vendors that use custom
options on Mac OS X must provide their own user interface via the
APDialogExtension attribute.
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 attributes such as page size, resolution, and so forth. For example, the following code sets the page size to A4 size:
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:
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.
This attribute requests special handling of the back side of pages
when doing duplexed (2-sided) output. Table 1
shows the supported keyword values for this attribute 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
attribute - if cupsBackSide is specified, cupsFlipDuplex
will be ignored.
*% 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
This boolean attribute 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
This string attribute 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 -"
Due to implementation differences between Mac OS X and Ghostscript,
the cupsFlipDuplex attribute is deprecated. Instead, use
the cupsBackSide attribute 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 Mac OS X and Flipped with
Ghostscript.
The default value is false.
Note:
Mac OS X drivers that previously used
cupsFlipDuplex may wish to provide both the old and
new attributes for maximum compatibility, for example:
*cupsBackSide: Rotated
*cupsFlipDuplex: true
Similarly, drivers written for other operating systems using
Ghostscript can use:
This optional attribute 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 (with spaces between each URI) 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
This attribute 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 Candian and French French
*cupsLanguages: "en_CA en_UK en_US fr_CA fr_FR"
This integer attribute 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
This string attribute specifies printer-specific "port
monitor" filters that may be used with the printer. The CUPS
scheduler also looks for the Protocols attribute 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 attribute.
The "urischeme" portion of the attribute 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"
This string attribute 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.
This required attribute describes which version of the CUPS
PPD file extensions was used. Currently it must be the string
"1.0", "1.1", "1.2", or "1.3".
This attribute defines additional option panes that are displayed in the
print dialog. Each attribute 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:
Starting with Mac OS X 10.5, each plug-in must be compiled "4-way fat"
(32-bit and 64-bit for both PowerPC and Intel) with garbage collection enabled
in order to be usable with all applications.
Examples:
*% Add two panes for finishing and driver options
*APDialogExtension: "/Library/Printers/vendor/finishing.plugin"
*APDialogExtension: "/Library/Printers/vendor/options.plugin"
This boolean attribute 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.
This string attribute specifies the Apple help book bundle to use when
looking up IPP reason codes for this printer driver. The
cupsIPPReason attribute maps
"help" URIs to this file.
This attribute 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"
This attribute 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 preset names are currently defined:
Photo_with_Paper_Auto-Detect; Photo printing
with paper auto-detect
Photo_with_Paper_Auto-Detect_-_Fine; Photo printing
with paper auto-detect - fine
Photo_on_Plain_Paper; Photo printing on plain paper
Photo_on_Plain_Paper_-_Fine; Photo printing on plain
paper - fine
Photo_on_Photo_Paper; Photo printing on photo paper
Photo_on_Photo_Paper_-_Fine; Photo printing on photo
paper - fine
Photo_on_Matte_Paper; Photo printing on matte paper
Photo_on_Matte_Paper_-_Fine; Photo printing on matte
paper - fine
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). Preset identifiers and their supported
values are documented in "Creating Printing Presets for iPhoto: Printing Presets File Format".
Presets, like options, can also be localized in multiple languages.
This attribute 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"
Added section on auto-configuration including the
OIDMainKeyword and ?MainKeyword
attributes.
Minor reorganization.
Changes in CUPS 1.3
Added cupsBackSide and deprecated cupsFlipDuplex.
Added text URI information to cupsIPPReason documentation.
Added APPrinterPreset, cupsIPPFinishings, and cupsPreFilter attributes.
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 attributes
Added custom option values support
Added APHelpBook attribute
Added APDuplexRequiresFlippedMargin attribute
Added cupsICCProfile attribute
Added cupsIPPReason attribute
Added cupsLanguages attribute
Added cupsPortMonitor attribute
Removed cupsProtocol attribute
Changes in CUPS 1.1
Added cupsFlipDuplex attribute
Added cupsProtocol attribute
Comments are owned by the poster. All other content is copyright 2007-2008 by Apple Inc. CUPS, the Common UNIX Printing System, and the CUPS logo are the trademark property of Apple Inc. All other trademarks are the property of their respective owners. Please report site problems to 'webmaster@cups.org'.