1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
3 <!-- SECTION: Specifications -->
5 <title>CUPS PPD Extensions
</title>
6 <meta name='keywords' content='Programming, PostScript Printer Description'
>
7 <link rel='stylesheet' type='text/css' href='../cups.css'
>
11 "$Id: spec-ppd.html 6252 2007-02-10 15:34:18Z mike $"
13 CUPS PPD extensions specification for the Common UNIX Printing System (CUPS).
15 Copyright 1997-2007 by Easy Software Products.
17 These coded instructions, statements, and computer programs are the
18 property of Easy Software Products and are protected by Federal
19 copyright law. Distribution and use rights are outlined in the file
20 "LICENSE.txt" which should have been included with this file. If this
21 file is missing or damaged please contact Easy Software Products
24 Attn: CUPS Licensing Information
25 Easy Software Products
26 44141 Airport View Drive, Suite 204
27 Hollywood, Maryland 20636 USA
30 EMail: cups-info@cups.org
31 WWW: http://www.cups.org
34 <h2 class='title'
><a name='INTRODUCTION'
>Introduction
</a></h2>
36 <p>This specification describes the attributes and extensions
38 href=
"http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf">
39 Adobe TechNote #
5003: PostScript Printer Description File Format
40 Specification Version
4.3</a>. PostScript Printer Description
41 (
"PPD") files describe the capabilities of each printer and are
42 used by CUPS to support printer-specific features and intelligent
45 <h2 class='title'
><a name='SYNTAX'
>PPD File Syntax
</a></h2>
47 <p>The PPD format is text-based and uses lines of up to
255
48 characters terminated by a carriage return, linefeed, or
49 combination of carriage return and line feed. The following ABNF
50 definition [RFC2234] defines the general format of lines in a PPD
54 PPD-FILE = HEADER +(DATA / COMMENT / LINE-END)
56 HEADER =
"*" 0x50.50.44.2D
.41.64.6F
.62.65 ":" ; *PPD-Adobe:
57 *WSP DQUOTE
"4.3" DQUOTE LINE-END
59 COMMENT =
"*%" *TCHAR LINE-END
61 DATA =
"*" 1*KCHAR [ WSP
1*KCHAR [
"/" 1*TCHAR ] ]
":"
62 1*(*WSP VALUE) LINE-END
64 VALUE =
1*TCHAR / DQUOTE
1*SCHAR DQUOTE
66 KCHAR = ALPHA / DIGIT /
"_" /
"." /
"-"
68 SCHAR = LINE-END / WSP / %x21 / %x23-
7E / %xA0-FF
70 TCHAR = %x20-
7E / %xA0-FF
72 LINE-END = CR / LF / CR LF
76 <h2 class='title'
><a name='ATTRIBUTES'
>General Attributes
</a></h2>
80 <p class='summary'
>*APBookFile:
"file URL"</p>
82 <p>This string attribute specifies the Apple help book file to use
83 for this printer driver.
</p>
88 *APBookFile:
"file:///Library/Printers/vendor/Help/filename"
91 <h3>APDuplexRequiresFlippedMargin
</h3>
93 <p class='summary'
>*APDuplexRequiresFlippedMargin: boolean
</p>
95 <p>This boolean attribute notifies the RIP filters that the
96 destination printer does not require the top and bottom margins
97 of the
<tt>ImageableArea
</tt> swapped for the back page. The
98 default is
<tt>true
</tt> when
<tt>cupsFlipDuplex
</tt> is
<tt>true
</tt> and
<tt>false
</tt> otherwise.
</p>
102 <pre class='command'
>
103 <em>*% Flip the back side images
</em>
104 *cupsFlipDuplex: true
106 <em>*% Don't swap the top and bottom margins for the back side
</em>
107 *APDuplexRequiresFlippedMargin: false
110 <p>Also see the related
<tt>cupsFlipDuplex
</tt> attribute.
</p>
112 <h3>cupsEvenDuplex
</h3>
114 <p class='summary'
>*cupsEvenDuplex: boolean
</p>
116 <p>This boolean attribute notifies the RIP filters that the
117 destination printer requires an even number of pages when
2-sided
118 printing is selected. The default value is
<code>false
</code>.
</p>
122 <pre class='command'
>
123 <em>*% Always send an even number of pages when duplexing
</em>
124 *cupsEvenDuplex: true
129 <p class='summary'
>*cupsFilter:
"source/type cost program"</p>
131 <p>This string attribute provides a conversion rule from the
132 given source type to the printer's native format using the
133 filter
"program". If a printer supports the source type directly,
134 the special filter program
"-" may be specified.
</p>
138 <pre class='command'
>
139 <em>*% Standard raster printer driver filter
</em>
140 *cupsFilter:
"application/vnd.cups-raster 100 rastertofoo"
142 <em>*% Plain text filter
</em>
143 *cupsFilter:
"text/plain 10 texttofoo"
145 <em>*% Pass-through filter for PostScript printers
</em>
146 *cupsFilter:
"application/vnd.cups-postscript 0 -"
149 <h3>cupsFlipDuplex
</h3>
151 <p class='summary'
>*cupsFlipDuplex: boolean
</p>
153 <p>This boolean attribute notifies the RIP filters that the
154 destination printer requires an upside-down image for the back
155 page. The default value is
<code>false
</code>.
</p>
159 <pre class='command'
>
160 <em>*% Flip the page image for the back side of duplexed output
</em>
161 *cupsFlipDuplex: true
164 <p>Also see the related
<tt>APDuplexRequiresFlippedMargins
</tt>
167 <h3>cupsIPPReason
</h3>
169 <p class='summary'
>*cupsIPPReason reason/Reason Text:
"optional URIs"</p>
171 <p>This optional attribute maps custom
172 <code>printer-state-reasons
</code> keywords that are generated by
173 the driver to human readable text. The optional URIs string
174 contains zero or more URIs separated by a newline. Each URI can
175 be a CUPS server absolute path to a help file under the
176 scheduler's
<code>DocumentRoot
</code> directory, a full HTTP URL
177 (
"http://www.domain.com/path/to/help/page.html"), or any other
178 valid URI which directs the user at additional information
179 concerning the condition that is being reported.
</p>
183 <pre class='command'
>
184 <em>*% Map com.vendor-error to text but no page
</em>
185 *cupsIPPReason com.vendor-error/A serious error occurred:
""
187 <em>*% Map com.vendor-error to text and a local page
</em>
188 *cupsIPPReason com.vendor-error/A serious error occurred:
"/help/com.vendor/error.html"
190 <em>*% Map com.vendor-error to text and a remote page
</em>
191 *cupsIPPReason com.vendor-error/A serious error occurred:
"http://www.vendor.com/help"
193 <em>*% Map com.vendor-error to text and a local, Apple help book, and remote page
</em>
194 *APHelpBook:
"file:///Library/Printers/vendor/Help/filename"
195 *cupsIPPReason com.vendor-error/A serious error occurred:
"/help/com.vendor/error.html
196 help:anchor='com.vendor-error'%20bookID=Vendor%20Help
197 http://www.vendor.com/help"
201 <h3>cupsLanguages
</h3>
203 <p class='summary'
>*cupsLanguages:
"locale list"</p>
205 <p>This attribute describes which language localizations are
206 included in the PPD. The
"locale list" string is a space-delimited
207 list of locale names (
"en",
"en_US",
"fr_FR", etc.)
</p>
211 <pre class='command'
>
212 <em>*% Specify Canadian, UK, and US English, and Candian and French French
</em>
213 *cupsLanguages:
"en_CA en_UK en_US fr_CA fr_FR"
216 <h3>cupsManualCopies
</h3>
218 <p class='summary'
>*cupsManualCopies: boolean
</p>
220 <p>This boolean attribute notifies the RIP filters that the
221 destination printer does not support copy generation in
222 hardware. The default value is
<code>false
</code>.
</p>
226 <pre class='command'
>
227 <em>*% Tell the RIP filters to generate the copies for us
</em>
228 *cupsManualCopies: true
231 <h3>cupsModelNumber
</h3>
233 <p class='summary'
>*cupsModelNumber: number
</p>
235 <p>This integer attribute specifies a printer-specific model
236 number. This number can be used by a filter program to adjust
237 the output for a specific model of printer.
</p>
241 <pre class='command'
>
242 <em>*% Specify an integer for a driver-specific model number
</em>
243 *cupsModelNumber:
1234
247 <h3>cupsPJLCharset
</h3>
249 <p class='summary'
>*cupsPJLCharset:
"ISO character set name"</p>
251 <p>This string attribute specifies the character set that is used
252 for strings in PJL commands. If not specified, US-ASCII is
257 <pre class='command'
>
258 <em>*% Specify UTF-
8 is used in PJL strings
</em>
259 *cupsPJLCharset:
"UTF-8"
263 <h3>cupsPortMonitor
</h3>
265 <p class='summary'
>*cupsPortMonitor urischeme/Descriptive Text:
"port monitor"</p>
267 <p>This string attribute specifies printer-specific
"port
268 monitor" filters that may be used with the printer. The CUPS
269 scheduler also looks for the
<tt>Protocols
</tt> attribute to see
270 if the
<tt>BCP
</tt> or
<tt>TBCP
</tt> protocols are supported. If
271 so, the corresponding port monitor (
"bcp" and
"tbcp",
272 respectively) is listed in the printer's
273 <tt>port-monitor-supported
</tt> attribute.
</p>
275 <p>The
"urischeme" portion of the attribute specifies the URI scheme
276 that this port monitor should be used for. Typically this is used to
277 pre-select a particular port monitor for each type of connection that
278 is supported by the printer. The
"port monitor" string can be
"none"
279 to disable the port monitor for the given URI scheme.
</p>
283 <pre class='command'
>
284 <em>*% Specify a PostScript printer that supports the TBCP protocol
</em>
287 <em>*% Specify that TBCP should be used for socket connections but not USB
</em>
288 *cupsPortMonitor socket/AppSocket Printing:
"tbcp"
289 *cupsPortMonitor usb/USB Printing:
"none"
291 <em>*% Specify a printer-specific port monitor for an Epson USB printer
</em>
292 *cupsPortMonitor usb/USB Status Monitor:
"epson-usb"
295 <h3>cupsPreFilter
</h3>
297 <p class='summary'
>*cupsPreFilter:
"source/type cost program"</p>
299 <p>This string attribute provides a pre-filter rule. The pre-filter
300 program will be inserted in the conversion chain immediately
301 before the filter that accepts the given MIME type.
</p>
305 <pre class='command'
>
306 <em>*% PDF pre-filter
</em>
307 *cupsPreFilter:
"application/pdf 100 mypdfprefilter"
309 <em>*% PNG pre-filter
</em>
310 *cupsPreFilter:
"image/png 0 mypngprefilter"
315 <p class='summary'
>*cupsVersion: major.minor
</p>
317 <p>This required attribute describes which version of the CUPS
318 PPD file extensions was used. Currently it must be the string
319 "1.0",
"1.1", or
"1.2".
</p>
323 <pre class='command'
>
324 <em>*% Specify a CUPS
1.2 driver
</em>
328 <h2 class='title'
><a name='OPTIONS'
>Custom Options
</a></h2>
330 <p>CUPS supports custom options using an extension of the
331 <tt>CustomPageSize
</tt> and
<tt>ParamCustomPageSize
</tt>
334 <pre class='command'
>
335 *CustomFoo True:
"command"
336 *ParamCustomFoo Name1/Text
1: order type minimum maximum
337 *ParamCustomFoo Name2/Text
2: order type minimum maximum
339 *ParamCustomFoo NameN/Text N: order type minimum maximum
342 <p>When the base option is part of the
<tt>JCLSetup
</tt> section,
343 the
"command" string contains JCL commands with
"\order"
344 placeholders for each numbered parameter. The CUPS API handles
345 any necessary value quoting for HP-PJL commands. For example, if
346 the JCL command string is
"@PJL SET PASSCODE=\1" and the first
347 option value is
"1234" then CUPS will output the string
348 "@PJL SET PASSCODE=1234".
</p>
350 <p>For non-
<tt>JCLSetup
</tt> options, the
"order" value is a
351 number from
1 to N and specifies the order of values as they are
352 placed on the stack before the command. For example, if the
353 PostScript command string is
354 "<</cupsReal1 2 1 roll>>setpagedevice" and the
355 option value is
"2.0" then CUPS will output the string
356 "2.0 <</cupsReal1 2 1 roll>>setpagedevice".
</p>
358 <p>The
"type" is one of the following keywords:
</p>
362 <li><tt>curve
</tt> - a real value from
"minimum" to
363 "maximum" representing a gamma correction curve using the
364 function: f(x) = x
<sup>value
</sup></li>
366 <li><tt>int
</tt> - an integer value from
"minimum" to
369 <li><tt>invcurve
</tt> - a real value from
"minimum" to
370 "maximum" representing a gamma correction curve using the
371 function: f(x) = x
<sup>1 / value
</sup></li>
373 <li><tt>passcode
</tt> - a string of numbers value with a
374 minimum of
"minimum" numbers and a maximum of
"maximum"
375 numbers (
"minimum" and
"maximum" are numbers and passcode
376 strings are not displayed in the user interface)
</li>
378 <li><tt>password
</tt> - a string value with a minimum of
379 "minimum" characters and a maximum of
"maximum"
380 characters (
"minimum" and
"maximum" are numbers and password
381 strings are not displayed in the user interface)
</li>
383 <li><tt>points
</tt> - a measurement value in points from
384 "minimum" to
"maximum"</li>
386 <li><tt>real
</tt> - a real value from
"minimum" to
389 <li><tt>string
</tt> - a string value with a minimum of
390 "minimum" characters and a maximum of
"maximum"
391 characters (
"minimum" and
"maximum" are numbers)
</li>
397 <pre class='command'
>
398 <em>*% Base JCL key code option
</em>
399 *OpenUI JCLPasscode/Key Code: PickOne
400 *OrderDependency:
10 JCLSetup *JCLPasscode
401 *DefaultJCLPasscode: None
402 *JCLPasscode None/No Code:
""
403 *JCLPasscode
1111:
"@PJL SET PASSCODE = 1111<0A>"
404 *JCLPasscode
2222:
"@PJL SET PASSCODE = 2222<0A>"
405 *JCLPasscode
3333:
"@PJL SET PASSCODE = 3333<0A>"
406 *JCLCloseUI: *JCLPasscode
408 <em>*% Custom JCL key code option
</em>
409 *CustomJCLPasscode True:
"@PJL SET PASSCODE = \1<0A>"
410 *ParamCustomJCLPasscode Code/Key Code:
1 passcode
4 4
413 <em>*% Base PostScript watermark option
</em>
414 *OpenUI WatermarkText/Watermark Text: PickOne
415 *OrderDependency:
10 AnySetup *WatermarkText
416 *DefaultWatermarkText: None
417 *WatermarkText None:
""
418 *WatermarkText Draft:
"<</cupsString1(Draft)>>setpagedevice"
419 *CloseUI: *WatermarkText
421 <em>*% Custom PostScript watermark option
</em>
422 *CustomWatermarkText True:
"<</cupsString1 3 -1 roll>>setpagedevice"
423 *ParamCustomWatermarkText Text:
1 string
0 32
426 <em>*% Base PostScript gamma/density option
</em>
427 *OpenUI GammaDensity/Gamma and Density: PickOne
428 *OrderDependency:
10 AnySetup *GammaDensity
429 *DefaultGammaDensity: Normal
430 *GammaDensity Normal/Normal:
"<</cupsReal1 1.0/cupsReal2 1.0>>setpagedevice"
431 *GammaDensity Light/Lighter:
"<</cupsReal1 0.9/cupsReal2 0.67>>setpagedevice"
432 *GammaDensity Dark/Darker:
"<</cupsReal1 1.1/cupsReal2 1.5>>setpagedevice"
433 *CloseUI: *GammaDensity
435 <em>*% Custom PostScript gamma/density option
</em>
436 *CustomGammaDensity True:
"<</cupsReal1 3 -1 roll/cupsReal2 5 -1>>setpagedevice"
437 *ParamCustomGammaDensity Gamma:
1 curve
0.1 10
438 *ParamCustomGammaDensity Density:
2 real
0 2
442 <h2 class='title'
><a name='PROFILES'
>Color Profiles
</a></h2>
444 <p>CUPS supports two types of color profiles. The first type is
445 based on sRGB and is used by the standard CUPS raster filters and
446 ESP Ghostscript. The second type is based on ICC profiles and is
447 used by the Core Graphics-based filters on MacOS X.
</p>
449 <blockquote><b>Note:
</b> At this time, none of the CUPS raster
450 filters support ICC profiles. This will be addressed as time
451 and resources permit.
</blockquote>
453 <h3>cupsColorProfile
</h3>
455 <p class='summary'
>*cupsColorProfile Resolution/MediaType:
"density
456 gamma m00 m01 m02 m10 m11 m12 m20 m21 m22"</p>
458 <p>This string attribute specifies an sRGB-based color profile
459 consisting of gamma and density controls and a
3x3 CMY color
460 transform matrix.
</p>
462 <p>The
<i>Resolution
</i> and
<i>MediaType
</i> values may be
"-"
463 to act as a wildcard. Otherwise they must match one of the
464 <tt>Resolution
</tt> or
<tt>MediaType
</tt> attributes defined in
467 <p>The
<i>density
</i> and
<i>gamma
</i> values define gamma and
468 density adjustment function such that:
</p>
470 <pre class='command'
>
471 f(x) = density * x
<sup style='font-size:
100%'
>gamma
</sup>
474 <p>The
<i>m00
</i> through
<i>m22
</i> values define a
3x3
475 transformation matrix for the CMY color values. The density
476 function is applied
<i>after
</i> the CMY transformation:
</p>
478 <pre class='command'
>
486 <pre class='command'
>
487 <em>*% Specify a profile for printing at
360dpi on all media types
</em>
488 *cupsColorProfile
360dpi/-:
"1.0 1.5 1.0 0.0 -0.2 -0.4 1.0 0.0 -0.2 0.0 1.0"
490 <em>*% Specify a profile for printing at
720dpi on Glossy media
</em>
491 *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"
493 <em>*% Specify a default profile for printing at all other resolutions and media types
</em>
494 *cupsColorProfile -/-:
"0.9 2.0 1.0 0.0 -0.2 -0.4 1.0 0.0 -0.2 0.0 1.0"
497 <h3>cupsICCProfile
</h3>
499 <p class='summary'
>*cupsICCProfile
500 ColorModel.MediaType.Resolution/Description:
"filename"</p>
502 <p>This attribute specifies an ICC color profile that is
503 used to convert the document colors to the device
504 colorspace. The
<tt>ColorModel
</tt>,
<tt>MediaType
</tt>, and
505 <tt>Resolution
</tt> keywords specify a selector for color
506 profiles. If omitted, the color profile will match any option
507 keyword for the corresponding main keyword.
</p>
509 <p>The
<tt>Description
</tt> specifies human-readable text that
510 is associated with the color profile. The
<tt>filename
</tt>
511 portion specifies the ICC color profile to use; if the filename
512 is not absolute, it is loaded relative to the
513 <var>/usr/share/cups/profiles
</var> directory.
</p>
517 <pre class='command'
>
518 <em>*% Specify a profile for CMYK printing at
360dpi on all media types
</em>
519 *cupsICCProfile CMYK.
.360dpi/
360dpi CMYK:
"vendor/foo-360-cmyk.icc"
521 <em>*% Specify a profile for RGB printing at
720dpi on Glossy media
</em>
522 *cupsColorProfile RGB.Glossy
.720dpi/
720dpi Glossy:
"vendor/foo-720-glossy-rgb.icc"
524 <em>*% Specify a default profile for printing at all other resolutions and media types
</em>
525 *cupsICCProfile ../Default:
"vendor/foo-default.icc"
528 <h4>Customizing the Profile Selection Keywords
</h4>
530 <p>The
<tt>MediaType
</tt> and
<tt>Resolution
</tt> keywords can be
531 reassigned to different main keywords, allowing drivers to do
532 color profile selection based on different parameters. The
533 <tt>cupsICCQualifier2
</tt> and
<tt>cupsICCQualifier3
</tt>
534 attributes define the mapping from selector to main keyword:
</p>
536 <pre class='command'
>
537 *cupsICCQualifier2: MainKeyword2
538 *cupsICCQualifier3: MainKeyword3
541 <p>The default mapping is as follows:
</p>
543 <pre class='command'
>
544 *cupsICCQualifier2: MediaType
545 *cupsICCQualifier3: Resolution
549 <h2 class='title'
><a name='I18N'
>Globalized PPD Support
</a></h2>
551 <p>CUPS
1.2 and higher adds support for PPD files containing multiple
552 languages by following the following additional rules:
</p>
556 <li>The
<tt>LanguageVersion
</tt> MUST be
<tt>English
</tt></li>
558 <li>The
<tt>LanguageEncoding
</tt> MUST be
<tt>ISOLatin1
</tt></li>
560 <li>The
<tt>cupsLanguages
</tt> attribute MUST be provided and
561 list each of the supported locales in the PPD file
</li>
563 <li>Main and option keywords MUST NOT exceed
34 (instead of
40)
564 characters to allow room for the locale prefixes in translation
567 <li>The main keyword
"Translation" MUST NOT be used
</li>
569 <li>Translation strings included with the main and option
570 keywords MUST NOT contain characters outside the ASCII
571 subset of ISOLatin1 and UTF-
8; developers wishing to use
572 characters outside ASCII MUST provide a separate set of
573 English localization attributes for the affected keywords.
</li>
575 <li>Localizations are specified using a locale prefix of
576 the form
"ll" or
"ll_CC." where
"ll" is the
2-letter ISO
577 language code and
"CC" is the
2-letter ISO country
580 <li>Locale-specific translation strings MUST be encoded
583 <li>Main keywords MUST be localized using one of the
585 <p><tt>*ll.Translation MainKeyword/translation
587 <tt>*ll_CC.Translation MainKeyword/translation
588 text:
""</tt></p></li>
590 <li>Option keywords MUST be localized using one of the
592 <p><tt>*ll.MainKeyword OptionKeyword/translation
594 <tt>*ll_CC.MainKeyword OptionKeyword/translation
595 text:
""</tt></p></li>
597 <li>Localization attributes MAY appear anywhere after the
598 first line of the PPD file
</li>
602 <blockquote><b>Note:
</b>
603 We use a
<tt>LanguageEncoding
</tt> value of
<tt>ISOLatin1
</tt>
604 and limit the allowed base translation strings to ASCII to avoid
605 character coding issues that would otherwise occur. In addition,
606 requiring the base translation strings to be in English allows
607 for easier fallback translation when no localization is provided
608 in the PPD file for a given locale.
</blockquote>
612 <pre class='command'
>
613 *LanguageVersion: English
614 *LanguageEncoding: ISOLatin1
615 *cupsLanguages:
"de_DE fr_FR"
616 *ModelName:
"Foobar Laser 9999"
618 <em>*% Localize ModelName for French and German
</em>
619 *fr_FR.Translation ModelName/La Foobar Laser
9999:
""
620 *de_DE.Translation ModelName/Foobar LaserDrucken
9999:
""
622 *cupsIPPReason com.vendor-error/A serious error occurred:
"/help/com.vendor/error.html"
623 <em>*% Localize printer-state-reason for French and German
</em>
624 *fr_FR.cupsIPPReason com.vendor-error/Une erreur s
èrieuse s'est produite:
"/help/com.vendor/error.html"
625 *de_DE.cupsIPPReason com.vendor-error/Eine ernste St
örung trat:
"/help/com.vendor/error.html"
629 *OpenUI *InputSlot/Paper Source: PickOne
630 *OrderDependency:
10 AnySetup *InputSlot
631 *DefaultInputSlot: Auto
632 <em>*% Localize InputSlot for French and German
</em>
633 *fr_FR.Translation InputSlot/Papier source:
""
634 *de_DE.Translation InputSlot/Papiereinzug:
""
635 *InputSlot Auto/Default:
"<</ManualFeed false>>setpagedevice"
636 <em>*% Localize InputSlot=Auto for French and German
</em>
637 *fr_FR.InputSlot Auto/Par Defaut:
""
638 *de_DE.InputSlot Auto/Standard:
""
639 *InputSlot Manual/Manual Feed:
"<</ManualFeed true>>setpagedevice"
640 <em>*% Localize InputSlot=Manual for French and German
</em>
641 *fr_FR.InputSlot Manual/Manuel mecanisme de alimentation:
""
642 *de_DE.InputSlot Manual/Manueller Einzug:
""
647 <h2 class='title'
><a name='RASTERPS'
>Writing PostScript Option Commands for Raster Drivers
</a></h2>
649 <p>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:
</p>
651 <pre class='command'
>
652 *PageSize A4:
"<</PageSize[595 842]>>setpagedevice"
655 <p>Custom options typically use other operators to organize the values into a key/value dictionary for
<tt>setpagedevice
</tt>. For example, our previous
<tt>CustomWatermarkText
</tt> option code uses the
<tt>roll
</tt> operator to move the custom string value into the dictionary for
<tt>setpagedevice
</tt>:
</p>
657 <pre class='command'
>
658 *CustomWatermarkText True:
"<</cupsString1 3 -1 roll>>setpagedevice"
661 <p>For a custom string value of
"My Watermark", CUPS will produce the following PostScript code for the option:
</p>
663 <pre class='command'
>
665 <</cupsString1
3 -
1 roll
>>setpagedevice
668 <p>The code moves the string value (
"My Watermark") from the bottom of the stack to the top, creating a dictionary that looks like:
</p>
670 <pre class='command'
>
671 <</cupsString1(My Watermark)
>>setpagedevice
674 <p>The resulting dictionary sets the page device attributes that are sent to your raster driver in the page header.
</p>
676 <h3>Supported PostScript Operators
</h3>
678 <p>CUPS supports the following PostScript operators in addition to the usual PostScript number, string (literal and hex-encoded), boolean, null, and name values:
</p>
682 <li><tt><<</tt> - Start a dictionary.
</li>
684 <li><tt>>></tt> - End a dictionary.
</li>
686 <li><tt>[
</tt> - Start an array.
</li>
688 <li><tt>]
</tt> - End an array.
</li>
690 <li><tt>copy
</tt> - Copy the top N objects on the stack.
</li>
692 <li><tt>dup
</tt> - Copy the top object on the stack.
</li>
694 <li><tt>index
</tt> - Copy the Nth from the top object on the stack.
</li>
696 <li><tt>pop
</tt> - Pop the top object on the stack.
</li>
698 <li><tt>roll
</tt> - Shift the top N objects on the stack.
</li>
700 <li><tt>setpagedevice
</tt> - Set the page header values according to the key/value dictionary on the stack.
</li>
704 <h3>Supported Page Device Attributes
</h3>
706 <p>Table
1 shows the supported page device attributes along with PostScript code examples.
</p>
709 <table summary='Supported Page Device Attributes'
>
710 <caption>Table
1:
<a name='TABLE_1'
>Supported Page Device Attributes
</a></caption>
721 <td><tt>AdvanceDistance
</tt></td>
723 <td>Specifies the number of points to advance roll media after printing.
</td>
724 <td><tt><</AdvanceDistance
18>>setpagedevice
</tt></td>
727 <td><tt>AdvanceMedia
</tt></td>
729 <td>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.
</td>
730 <td><tt><</AdvanceMedia
4>>setpagedevice
</tt></td>
733 <td><tt>Collate
</tt></td>
735 <td>Specifies whether collated copies are required.
</td>
736 <td><tt><</Collate true
>>setpagedevice
</tt></td>
739 <td><tt>CutMedia
</tt></td>
741 <td>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.
</td>
742 <td><tt><</CutMedia
1>>setpagedevice
</tt></td>
745 <td><tt>Duplex
</tt></td>
747 <td>Specifies whether
2-sided printing is required.
</td>
748 <td><tt><</Duplex true
>>setpagedevice
</tt></td>
751 <td><tt>HWResolution
</tt></td>
752 <td>Integer Array
</td>
753 <td>Specifies the resolution of the page image in pixels per inch.
</td>
754 <td><tt><</HWResolution[
1200 1200]
>>setpagedevice
</tt></td>
757 <td><tt>InsertSheet
</tt></td>
759 <td>Specifies whether to insert a blank sheet before the job.
</td>
760 <td><tt><</InsertSheet true
>>setpagedevice
</tt></td>
763 <td><tt>Jog
</tt></td>
765 <td>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.
</td>
766 <td><tt><</Jog
2>>setpagedevice
</tt></td>
769 <td><tt>LeadingEdge
</tt></td>
771 <td>Specifies the leading edge of the media:
0 = top,
1 = right,
2 = bottom,
3 = left.
</td>
772 <td><tt><</LeadingEdge
0>>setpagedevice
</tt></td>
775 <td><tt>ManualFeed
</tt></td>
777 <td>Specifies whether media should be drawn from the manual feed tray. Note: The
<tt>MediaPosition
</tt> attribute is preferred over the
<tt>ManualFeed
</tt> attribute.
</td>
778 <td><tt><</ManualFeed true
>>setpagedevice
</tt></td>
781 <td><tt>MediaClass
</tt></td>
783 <td>Specifies a named media.
</td>
784 <td><tt><</MediaClass (Invoices)
>>setpagedevice
</tt></td>
787 <td><tt>MediaColor
</tt></td>
789 <td>Specifies the color of the media.
</td>
790 <td><tt><</MediaColor
>>setpagedevice
</tt></td>
793 <td><tt>MediaPosition
</tt></td>
795 <td>Specifies the tray or source of the media.
</td>
796 <td><tt><</MediaPosition
12>>setpagedevice
</tt></td>
799 <td><tt>MediaType
</tt></td>
801 <td>Specifies the general media type.
</td>
802 <td><tt><</MediaType (Glossy)
>>setpagedevice
</tt></td>
805 <td><tt>MediaWeight
</tt></td>
807 <td>Specifies the media weight in grams per meter
<sup>2</sup>.
</td>
808 <td><tt><</MediaWeight
100>>setpagedevice
</tt></td>
811 <td><tt>MirrorPrint
</tt></td>
813 <td>Specifies whether to flip the output image horizontally.
</td>
814 <td><tt><</MirrorPrint true
>>setpagedevice
</tt></td>
817 <td><tt>NegativePrint
</tt></td>
819 <td>Specifies whether to invert the output image.
</td>
820 <td><tt><</NegativePrint true
>>setpagedevice
</tt></td>
823 <td><tt>NumCopies
</tt></td>
825 <td>Specifies the number of copies to produce of each page.
</td>
826 <td><tt><</NumCopies
100>>setpagedevice
</tt></td>
829 <td><tt>Orientation
</tt></td>
831 <td>Specifies the orientation of the output:
0 = portrait,
1 = landscape rotated counter-clockwise,
2 = upside-down,
3 = landscape rotated clockwise.
</td>
832 <td><tt><</Orientation
3>>setpagedevice
</tt></td>
835 <td><tt>OutputFaceUp
</tt></td>
837 <td>Specifies whether to place the media face-up in the output bin/tray.
</td>
838 <td><tt><</OutputFaceUp true
>>setpagedevice
</tt></td>
841 <td><tt>OutputType
</tt></td>
843 <td>Specifies the output type name.
</td>
844 <td><tt><</OutputType (Photo)
>>setpagedevice
</tt></td>
847 <td><tt>PageSize
</tt></td>
848 <td>Integer/Real Array
</td>
849 <td>Specifies the width and length/height of the page in points.
</td>
850 <td><tt><</PageSize[
595 842]
>>setpagedevice
</tt></td>
853 <td><tt>Separations
</tt></td>
855 <td>Specifies whether to produce color separations.
</td>
856 <td><tt><</Separations true
>>setpagedevice
</tt></td>
859 <td><tt>TraySwitch
</tt></td>
861 <td>Specifies whether to switch trays automatically.
</td>
862 <td><tt><</TraySwitch true
>>setpagedevice
</tt></td>
865 <td><tt>Tumble
</tt></td>
867 <td>Specifies whether the back sides of pages are rotated
180 degrees.
</td>
868 <td><tt><</Tumble true
>>setpagedevice
</tt></td>
871 <td><tt>cupsBorderlessScalingFactor
</tt></td>
873 <td>Specifies the amount to scale the page image dimensions.
</td>
874 <td><tt><</cupsBorderlessScalingFactor
1.01>>setpagedevice
</tt></td>
877 <td><tt>cupsColorOrder
</tt></td>
879 <td>Specifies the order of colors:
0 = chunked,
1 = banded,
2 = planar.
</td>
880 <td><tt><</cupsColorOrder
0>>setpagedevice
</tt></td>
883 <td><tt>cupsColorSpace
</tt></td>
885 <td>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)
</td>
886 <td><tt><</cupsColorSpace
>>setpagedevice
</tt></td>
889 <td><tt>cupsCompression
</tt></td>
891 <td>Specifies a driver compression type/mode.
</td>
892 <td><tt><</cupsCompression
2>>setpagedevice
</tt></td>
895 <td><tt>cupsInteger0
<br>
897 cupsInteger15
</tt></td>
899 <td>Specifies driver integer values.
</td>
900 <td><tt><</cupsInteger11
1234>>setpagedevice
</tt></td>
903 <td><tt>cupsMarkerType
</tt></td>
905 <td>Specifies the type of ink/toner to use.
</td>
906 <td><tt><</cupsMarkerType (Black+Color)
>>setpagedevice
</tt></td>
909 <td><tt>cupsMediaType
</tt></td>
911 <td>Specifies a numeric media type.
</td>
912 <td><tt><</cupsMediaType
999>>setpagedevice
</tt></td>
915 <td><tt>cupsPageSizeName
</tt></td>
917 <td>Specifies the name of the page size.
</td>
918 <td><tt><</cupsPageSizeName (A4.Full)
>>setpagedevice
</tt></td>
921 <td><tt>cupsPreferredBitsPerColor
</tt></td>
923 <td>Specifies the preferred number of bits per color, typically
8 or
16.
</td>
924 <td><tt><</cupsPreferredBitsPerColor
16>>setpagedevice
</tt></td>
927 <td><tt>cupsReal0
<br>
931 <td>Specifies driver real number values.
</td>
932 <td><tt><</cupsReal15
1.234>>setpagedevice
</tt></td>
935 <td><tt>cupsRenderingIntent
</tt></td>
937 <td>Specifies the color rendering intent.
</td>
938 <td><tt><</cupsRenderingIntent (AbsoluteColorimetric)
>>setpagedevice
</tt></td>
941 <td><tt>cupsRowCount
</tt></td>
943 <td>Specifies the number of rows of raster data to print on each line for some drivers.
</td>
944 <td><tt><</cupsRowCount
24>>setpagedevice
</tt></td>
947 <td><tt>cupsRowFeed
</tt></td>
949 <td>Specifies the number of rows to feed between passes for some drivers.
</td>
950 <td><tt><</cupsRowFeed
17>>setpagedevice
</tt></td>
953 <td><tt>cupsRowStep
</tt></td>
955 <td>Specifies the number of lines between columns/rows on the print head for some drivers.
</td>
956 <td><tt><</cupsRowStep
2>>setpagedevice
</tt></td>
959 <td><tt>cupsString0
<br>
961 cupsString15
</tt></td>
963 <td>Specifies driver string values.
</td>
964 <td><tt><</cupsString0(String Value)
>>setpagedevice
</tt></td>
970 <h2 class='title'
><a name='HISTORY'
>Change History
</a></h2>
972 <h3>Changes in CUPS
1.3</h3>
976 <li>Added
<tt>cupsPreFilter
</tt> attribute.
</li>
980 <h3>Changes in CUPS
1.2.8</h3>
984 <li>Added section on supported PostScript commands for raster
989 <h3>Changes in CUPS
1.2</h3>
993 <li>Added globalization support attributes
</li>
995 <li>Added custom option values support
</li>
997 <li>Added
<tt>APBookFile
</tt> attribute
</li>
999 <li>Added
<tt>APDuplexRequiresFlippedMargin
</tt> attribute
</li>
1001 <li>Added
<tt>cupsICCProfile
</tt> attribute
</li>
1003 <li>Added
<tt>cupsIPPReason
</tt> attribute
</li>
1005 <li>Added
<tt>cupsLanguages
</tt> attribute
</li>
1007 <li>Added
<tt>cupsPortMonitor
</tt> attribute
</li>
1009 <li>Removed
<tt>cupsProtocol
</tt> attribute
</li>
1013 <h3>Changes in CUPS
1.1</h3>
1017 <li>Added
<tt>cupsFlipDuplex
</tt> attribute
</li>
1019 <li>Added
<tt>cupsProtocol
</tt> attribute
</li>