]> git.ipfire.org Git - thirdparty/cups.git/blame - doc/help/spec-ppd.html
Load cups into easysw/current.
[thirdparty/cups.git] / doc / help / spec-ppd.html
CommitLineData
ef416fc2 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2<html>
4744bd90 3<!-- SECTION: Specifications -->
ef416fc2 4<head>
5 <title>CUPS PPD Extensions</title>
6 <meta name='keywords' content='Programming, PostScript Printer Description'>
a4d04587 7 <link rel='stylesheet' type='text/css' href='../cups.css'>
ef416fc2 8</head>
9<body>
10<!--
b94498cf 11 "$Id: spec-ppd.html 6457 2007-04-17 18:40:55Z mike $"
ef416fc2 12
13 CUPS PPD extensions specification for the Common UNIX Printing System (CUPS).
14
f7deaa1a 15 Copyright 1997-2007 by Easy Software Products.
ef416fc2 16
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
22 at:
23
24 Attn: CUPS Licensing Information
25 Easy Software Products
26 44141 Airport View Drive, Suite 204
27 Hollywood, Maryland 20636 USA
28
29 Voice: (301) 373-9600
30 EMail: cups-info@cups.org
31 WWW: http://www.cups.org
32-->
33
34<h2 class='title'><a name='INTRODUCTION'>Introduction</a></h2>
35
36<p>This specification describes the attributes and extensions
37that CUPS adds to <a
4744bd90 38href="http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf">
ef416fc2 39Adobe TechNote #5003: PostScript Printer Description File Format
40Specification Version 4.3</a>. PostScript Printer Description
41("PPD") files describe the capabilities of each printer and are
42used by CUPS to support printer-specific features and intelligent
43filtering.</p>
44
45<h2 class='title'><a name='SYNTAX'>PPD File Syntax</a></h2>
46
47<p>The PPD format is text-based and uses lines of up to 255
48characters terminated by a carriage return, linefeed, or
49combination of carriage return and line feed. The following ABNF
50definition [RFC2234] defines the general format of lines in a PPD
51file:</p>
52
53<pre class='command'>
54PPD-FILE = HEADER +(DATA / COMMENT / LINE-END)
55
56HEADER = "*" 0x50.50.44.2D.41.64.6F.62.65 ":" ; *PPD-Adobe:
57 *WSP DQUOTE "4.3" DQUOTE LINE-END
58
59COMMENT = "*%" *TCHAR LINE-END
60
61DATA = "*" 1*KCHAR [ WSP 1*KCHAR [ "/" 1*TCHAR ] ] ":"
62 1*(*WSP VALUE) LINE-END
63
64VALUE = 1*TCHAR / DQUOTE 1*SCHAR DQUOTE
65
66KCHAR = ALPHA / DIGIT / "_" / "." / "-"
67
68SCHAR = LINE-END / WSP / %x21 / %x23-7E / %xA0-FF
69
70TCHAR = %x20-7E / %xA0-FF
71
72LINE-END = CR / LF / CR LF
73</pre>
74
75
76<h2 class='title'><a name='ATTRIBUTES'>General Attributes</a></h2>
77
4744bd90 78<h3>APBookFile</h3>
79
80<p class='summary'>*APBookFile: "file URL"</p>
81
82<p>This string attribute specifies the Apple help book file to use
83for this printer driver.</p>
84
85<p>Example:</p>
86
87<pre class='command'>
88*APBookFile: "file:///Library/Printers/vendor/Help/filename"
89</pre>
90
a4d04587 91<h3>APDuplexRequiresFlippedMargin</h3>
92
93<p class='summary'>*APDuplexRequiresFlippedMargin: boolean</p>
94
95<p>This boolean attribute notifies the RIP filters that the
96destination printer does not require the top and bottom margins
97of the <tt>ImageableArea</tt> swapped for the back page. The
411affcf 98default is <tt>true</tt> when <tt>cupsFlipDuplex</tt> is <tt>true</tt> and <tt>false</tt> otherwise.</p>
ef416fc2 99
a4d04587 100<p>Example:</p>
ef416fc2 101
102<pre class='command'>
411affcf 103<em>*% Flip the back side images</em>
104*cupsFlipDuplex: true
105
a4d04587 106<em>*% Don't swap the top and bottom margins for the back side</em>
107*APDuplexRequiresFlippedMargin: false
ef416fc2 108</pre>
109
a4d04587 110<p>Also see the related <tt>cupsFlipDuplex</tt> attribute.</p>
111
2abf387c 112<h3>cupsEvenDuplex</h3>
113
114<p class='summary'>*cupsEvenDuplex: boolean</p>
115
116<p>This boolean attribute notifies the RIP filters that the
117destination printer requires an even number of pages when 2-sided
118printing is selected. The default value is <code>false</code>.</p>
119
120<p>Example:</p>
121
122<pre class='command'>
123<em>*% Always send an even number of pages when duplexing</em>
124*cupsEvenDuplex: true
125</pre>
126
a4d04587 127<h3>cupsFilter</h3>
128
129<p class='summary'>*cupsFilter: "source/type cost program"</p>
130
131<p>This string attribute provides a conversion rule from the
132given source type to the printer's native format using the
133filter "program". If a printer supports the source type directly,
134the special filter program "-" may be specified.</p>
ef416fc2 135
136<p>Examples:</p>
137
138<pre class='command'>
139<em>*% Standard raster printer driver filter</em>
140*cupsFilter: "application/vnd.cups-raster 100 rastertofoo"
141
142<em>*% Plain text filter</em>
143*cupsFilter: "text/plain 10 texttofoo"
144
145<em>*% Pass-through filter for PostScript printers</em>
146*cupsFilter: "application/vnd.cups-postscript 0 -"
147</pre>
148
149<h3>cupsFlipDuplex</h3>
150
a4d04587 151<p class='summary'>*cupsFlipDuplex: boolean</p>
152
ef416fc2 153<p>This boolean attribute notifies the RIP filters that the
154destination printer requires an upside-down image for the back
a4d04587 155page. The default value is <code>false</code>.</p>
ef416fc2 156
157<p>Example:</p>
158
159<pre class='command'>
160<em>*% Flip the page image for the back side of duplexed output</em>
161*cupsFlipDuplex: true
162</pre>
163
2abf387c 164<p>Also see the related <tt>APDuplexRequiresFlippedMargins</tt>
165attribute.</p>
a4d04587 166
4744bd90 167<h3>cupsIPPReason</h3>
168
169<p class='summary'>*cupsIPPReason reason/Reason Text: "optional URIs"</p>
170
171<p>This optional attribute maps custom
172<code>printer-state-reasons</code> keywords that are generated by
173the driver to human readable text. The optional URIs string
174contains zero or more URIs separated by a newline. Each URI can
175be a CUPS server absolute path to a help file under the
176scheduler's <code>DocumentRoot</code> directory, a full HTTP URL
177("http://www.domain.com/path/to/help/page.html"), or any other
178valid URI which directs the user at additional information
179concerning the condition that is being reported.</p>
180
181<p>Examples:</p>
182
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: ""
186
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"
189
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"
192
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
196help:anchor='com.vendor-error'%20bookID=Vendor%20Help
197http://www.vendor.com/help"
198*End
199</pre>
200
a4d04587 201<h3>cupsLanguages</h3>
202
203<p class='summary'>*cupsLanguages: "locale list"</p>
204
205<p>This attribute describes which language localizations are
206included in the PPD. The "locale list" string is a space-delimited
b94498cf 207list of locale names ("en", "en_US", "fr_CA", etc.)</p>
a4d04587 208
209<p>Example:</p>
210
211<pre class='command'>
212<em>*% Specify Canadian, UK, and US English, and Candian and French French</em>
b94498cf 213*cupsLanguages: "en_CA en_UK en_US fr_CA fr_CA"
a4d04587 214</pre>
215
ef416fc2 216<h3>cupsManualCopies</h3>
217
a4d04587 218<p class='summary'>*cupsManualCopies: boolean</p>
219
ef416fc2 220<p>This boolean attribute notifies the RIP filters that the
221destination printer does not support copy generation in
a4d04587 222hardware. The default value is <code>false</code>.</p>
ef416fc2 223
224<p>Example:</p>
225
226<pre class='command'>
227<em>*% Tell the RIP filters to generate the copies for us</em>
228*cupsManualCopies: true
229</pre>
230
231<h3>cupsModelNumber</h3>
232
a4d04587 233<p class='summary'>*cupsModelNumber: number</p>
234
ef416fc2 235<p>This integer attribute specifies a printer-specific model
236number. This number can be used by a filter program to adjust
237the output for a specific model of printer.</p>
238
239<p>Example:</p>
240
241<pre class='command'>
242<em>*% Specify an integer for a driver-specific model number</em>
243*cupsModelNumber: 1234
244</pre>
245
f7deaa1a 246
247<h3>cupsPJLCharset</h3>
248
249<p class='summary'>*cupsPJLCharset: "ISO character set name"</p>
250
251<p>This string attribute specifies the character set that is used
252for strings in PJL commands. If not specified, US-ASCII is
253assumed.</p>
254
255<p>Example:</p>
256
257<pre class='command'>
258<em>*% Specify UTF-8 is used in PJL strings</em>
259*cupsPJLCharset: "UTF-8"
260</pre>
261
262
ef416fc2 263<h3>cupsPortMonitor</h3>
264
a4d04587 265<p class='summary'>*cupsPortMonitor urischeme/Descriptive Text: "port monitor"</p>
266
ef416fc2 267<p>This string attribute specifies printer-specific "port
268monitor" filters that may be used with the printer. The CUPS
269scheduler also looks for the <tt>Protocols</tt> attribute to see
270if the <tt>BCP</tt> or <tt>TBCP</tt> protocols are supported. If
271so, the corresponding port monitor ("bcp" and "tbcp",
272respectively) is listed in the printer's
273<tt>port-monitor-supported</tt> attribute.</p>
274
a4d04587 275<p>The "urischeme" portion of the attribute specifies the URI scheme
276that this port monitor should be used for. Typically this is used to
277pre-select a particular port monitor for each type of connection that
278is supported by the printer. The "port monitor" string can be "none"
279to disable the port monitor for the given URI scheme.</p>
280
ef416fc2 281<p>Examples:</p>
282
283<pre class='command'>
284<em>*% Specify a PostScript printer that supports the TBCP protocol</em>
285*Protocols: TBCP PJL
286
a4d04587 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"
290
ef416fc2 291<em>*% Specify a printer-specific port monitor for an Epson USB printer</em>
a4d04587 292*cupsPortMonitor usb/USB Status Monitor: "epson-usb"
ef416fc2 293</pre>
294
f7deaa1a 295<h3>cupsPreFilter</h3>
296
297<p class='summary'>*cupsPreFilter: "source/type cost program"</p>
298
299<p>This string attribute provides a pre-filter rule. The pre-filter
300program will be inserted in the conversion chain immediately
301before the filter that accepts the given MIME type.</p>
302
303<p>Examples:</p>
304
305<pre class='command'>
306<em>*% PDF pre-filter</em>
307*cupsPreFilter: "application/pdf 100 mypdfprefilter"
308
309<em>*% PNG pre-filter</em>
310*cupsPreFilter: "image/png 0 mypngprefilter"
311</pre>
312
ef416fc2 313<h3>cupsVersion</h3>
314
a4d04587 315<p class='summary'>*cupsVersion: major.minor</p>
316
ef416fc2 317<p>This required attribute describes which version of the CUPS
318PPD file extensions was used. Currently it must be the string
319"1.0", "1.1", or "1.2".</p>
320
321<p>Example:</p>
322
323<pre class='command'>
324<em>*% Specify a CUPS 1.2 driver</em>
325*cupsVersion: "1.2"
326</pre>
327
ef416fc2 328<h2 class='title'><a name='OPTIONS'>Custom Options</a></h2>
329
330<p>CUPS supports custom options using an extension of the
331<tt>CustomPageSize</tt> and <tt>ParamCustomPageSize</tt>
332syntax:</p>
333
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
338...
339*ParamCustomFoo NameN/Text N: order type minimum maximum
340</pre>
341
342<p>When the base option is part of the <tt>JCLSetup</tt> section,
343the "command" string contains JCL commands with "\order"
344placeholders for each numbered parameter. The CUPS API handles
a4d04587 345any necessary value quoting for HP-PJL commands. For example, if
346the JCL command string is "@PJL SET PASSCODE=\1" and the first
347option value is "1234" then CUPS will output the string
348"@PJL SET PASSCODE=1234".</p>
ef416fc2 349
350<p>For non-<tt>JCLSetup</tt> options, the "order" value is a
351number from 1 to N and specifies the order of values as they are
a4d04587 352placed on the stack before the command. For example, if the
353PostScript command string is
354"&lt;&lt;/cupsReal1 2 1 roll&gt;&gt;setpagedevice" and the
355option value is "2.0" then CUPS will output the string
356"2.0 &lt;&lt;/cupsReal1 2 1 roll&gt;&gt;setpagedevice".</p>
ef416fc2 357
358<p>The "type" is one of the following keywords:</p>
359
360<ul>
361
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>
365
366 <li><tt>int</tt> - an integer value from "minimum" to
367 "maximum"</li>
368
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>
372
373 <li><tt>passcode</tt> - a string of numbers value with a
374 minimum of "minimum" numbers and a maximum of "maximum"
a4d04587 375 numbers ("minimum" and "maximum" are numbers and passcode
376 strings are not displayed in the user interface)</li>
ef416fc2 377
378 <li><tt>password</tt> - a string value with a minimum of
379 "minimum" characters and a maximum of "maximum"
a4d04587 380 characters ("minimum" and "maximum" are numbers and password
381 strings are not displayed in the user interface)</li>
ef416fc2 382
383 <li><tt>points</tt> - a measurement value in points from
384 "minimum" to "maximum"</li>
385
386 <li><tt>real</tt> - a real value from "minimum" to
387 "maximum"</li>
388
389 <li><tt>string</tt> - a string value with a minimum of
390 "minimum" characters and a maximum of "maximum"
a4d04587 391 characters ("minimum" and "maximum" are numbers)</li>
ef416fc2 392
393</ul>
394
395<p>Examples:</p>
396
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&lt;0A&gt;"
404*JCLPasscode 2222: "@PJL SET PASSCODE = 2222&lt;0A&gt;"
405*JCLPasscode 3333: "@PJL SET PASSCODE = 3333&lt;0A&gt;"
406*JCLCloseUI: *JCLPasscode
407
408<em>*% Custom JCL key code option</em>
409*CustomJCLPasscode True: "@PJL SET PASSCODE = \1&lt;0A&gt;"
410*ParamCustomJCLPasscode Code/Key Code: 1 passcode 4 4
411
412
a4d04587 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: "&lt;&lt;/cupsString1(Draft)&gt;&gt;setpagedevice"
419*CloseUI: *WatermarkText
420
421<em>*% Custom PostScript watermark option</em>
b86bc4cf 422*CustomWatermarkText True: "&lt;&lt;/cupsString1 3 -1 roll&gt;&gt;setpagedevice"
a4d04587 423*ParamCustomWatermarkText Text: 1 string 0 32
424
425
ef416fc2 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: "&lt;&lt;/cupsReal1 1.0/cupsReal2 1.0&gt;&gt;setpagedevice"
431*GammaDensity Light/Lighter: "&lt;&lt;/cupsReal1 0.9/cupsReal2 0.67&gt;&gt;setpagedevice"
432*GammaDensity Dark/Darker: "&lt;&lt;/cupsReal1 1.1/cupsReal2 1.5&gt;&gt;setpagedevice"
a4d04587 433*CloseUI: *GammaDensity
ef416fc2 434
435<em>*% Custom PostScript gamma/density option</em>
b86bc4cf 436*CustomGammaDensity True: "&lt;&lt;/cupsReal1 3 -1 roll/cupsReal2 5 -1&gt;&gt;setpagedevice"
ef416fc2 437*ParamCustomGammaDensity Gamma: 1 curve 0.1 10
438*ParamCustomGammaDensity Density: 2 real 0 2
439</pre>
440
441
442<h2 class='title'><a name='PROFILES'>Color Profiles</a></h2>
443
a4d04587 444<p>CUPS supports two types of color profiles. The first type is
445based on sRGB and is used by the standard CUPS raster filters and
446ESP Ghostscript. The second type is based on ICC profiles and is
447used by the Core Graphics-based filters on MacOS X.</p>
448
449<blockquote><b>Note:</b> At this time, none of the CUPS raster
450filters support ICC profiles. This will be addressed as time
451and resources permit.</blockquote>
452
ef416fc2 453<h3>cupsColorProfile</h3>
454
a4d04587 455<p class='summary'>*cupsColorProfile Resolution/MediaType: "density
456gamma m00 m01 m02 m10 m11 m12 m20 m21 m22"</p>
ef416fc2 457
a4d04587 458<p>This string attribute specifies an sRGB-based color profile
459consisting of gamma and density controls and a 3x3 CMY color
460transform matrix.</p>
ef416fc2 461
462<p>The <i>Resolution</i> and <i>MediaType</i> values may be "-"
463to act as a wildcard. Otherwise they must match one of the
464<tt>Resolution</tt> or <tt>MediaType</tt> attributes defined in
465the PPD file.</p>
466
467<p>The <i>density</i> and <i>gamma</i> values define gamma and
468density adjustment function such that:</p>
469
470<pre class='command'>
471f(x) = density * x <sup style='font-size: 100%'>gamma</sup>
472</pre>
473
474<p>The <i>m00</i> through <i>m22</i> values define a 3x3
475transformation matrix for the CMY color values. The density
476function is applied <i>after</i> the CMY transformation:</p>
477
478<pre class='command'>
479| m00 m01 m02 |
480| m10 m11 m12 |
481| m20 m21 m22 |
482</pre>
483
484<p>Examples:</p>
485
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"
489
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"
492
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"
495</pre>
496
497<h3>cupsICCProfile</h3>
498
a4d04587 499<p class='summary'>*cupsICCProfile
500ColorModel.MediaType.Resolution/Description: "filename"</p>
ef416fc2 501
a4d04587 502<p>This attribute specifies an ICC color profile that is
503used to convert the document colors to the device
504colorspace. The <tt>ColorModel</tt>, <tt>MediaType</tt>, and
ef416fc2 505<tt>Resolution</tt> keywords specify a selector for color
506profiles. If omitted, the color profile will match any option
507keyword for the corresponding main keyword.</p>
508
509<p>The <tt>Description</tt> specifies human-readable text that
510is associated with the color profile. The <tt>filename</tt>
511portion specifies the ICC color profile to use; if the filename
512is not absolute, it is loaded relative to the
513<var>/usr/share/cups/profiles</var> directory.</p>
514
515<p>Examples:</p>
516
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"
520
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"
523
524<em>*% Specify a default profile for printing at all other resolutions and media types</em>
fa73b229 525*cupsICCProfile ../Default: "vendor/foo-default.icc"
ef416fc2 526</pre>
527
528<h4>Customizing the Profile Selection Keywords</h4>
529
a9252913 530<p>The <tt>MediaType</tt> and <tt>Resolution</tt> keywords can be
531reassigned to different main keywords, allowing drivers to do
532color profile selection based on different parameters. The
533<tt>cupsICCQualifier2</tt> and <tt>cupsICCQualifier3</tt>
ef416fc2 534attributes define the mapping from selector to main keyword:</p>
535
536<pre class='command'>
a9252913 537*cupsICCQualifier2: MainKeyword2
538*cupsICCQualifier3: MainKeyword3
ef416fc2 539</pre>
540
541<p>The default mapping is as follows:</p>
542
543<pre class='command'>
ef416fc2 544*cupsICCQualifier2: MediaType
545*cupsICCQualifier3: Resolution
546</pre>
547
548
ecdc0628 549<h2 class='title'><a name='I18N'>Globalized PPD Support</a></h2>
ef416fc2 550
551<p>CUPS 1.2 and higher adds support for PPD files containing multiple
a4d04587 552languages by following the following additional rules:</p>
ef416fc2 553
554<ol>
555
a4d04587 556 <li>The <tt>LanguageVersion</tt> MUST be <tt>English</tt></li>
557
558 <li>The <tt>LanguageEncoding</tt> MUST be <tt>ISOLatin1</tt></li>
559
560 <li>The <tt>cupsLanguages</tt> attribute MUST be provided and
561 list each of the supported locales in the PPD file</li>
562
563 <li>Main and option keywords MUST NOT exceed 34 (instead of 40)
564 characters to allow room for the locale prefixes in translation
565 attributes</li>
ef416fc2 566
a4d04587 567 <li>The main keyword "Translation" MUST NOT be used</li>
ef416fc2 568
a4d04587 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>
ef416fc2 574
a4d04587 575 <li>Localizations are specified using a locale prefix of
ef416fc2 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
b94498cf 578 code<ul>
579 <li>A generic language translation ("ll") SHOULD be provided with country-specific differences ("ll_CC") provided only as needed</li>
580 <li>For historical reasons, the "zh" and "zh_CN" locales map to Simplified Chinese while the "zh_TW" locale maps to Traditional Chinese</li>
581 </ul></li>
ef416fc2 582
a4d04587 583 <li>Locale-specific translation strings MUST be encoded
584 using UTF-8.</li>
ef416fc2 585
a4d04587 586 <li>Main keywords MUST be localized using one of the
ef416fc2 587 following forms:
588 <p><tt>*ll.Translation MainKeyword/translation
589 text: ""</tt><br />
590 <tt>*ll_CC.Translation MainKeyword/translation
591 text: ""</tt></p></li>
592
a4d04587 593 <li>Option keywords MUST be localized using one of the
ef416fc2 594 following forms:
595 <p><tt>*ll.MainKeyword OptionKeyword/translation
596 text: ""</tt><br />
597 <tt>*ll_CC.MainKeyword OptionKeyword/translation
598 text: ""</tt></p></li>
599
a4d04587 600 <li>Localization attributes MAY appear anywhere after the
601 first line of the PPD file</li>
602
ef416fc2 603</ol>
604
a4d04587 605<blockquote><b>Note:</b>
606We use a <tt>LanguageEncoding</tt> value of <tt>ISOLatin1</tt>
607and limit the allowed base translation strings to ASCII to avoid
608character coding issues that would otherwise occur. In addition,
609requiring the base translation strings to be in English allows
610for easier fallback translation when no localization is provided
611in the PPD file for a given locale.</blockquote>
ef416fc2 612
a4d04587 613<p>Examples:</p>
ef416fc2 614
615<pre class='command'>
616*LanguageVersion: English
617*LanguageEncoding: ISOLatin1
b94498cf 618*cupsLanguages: "de fr_CA"
ef416fc2 619*ModelName: "Foobar Laser 9999"
620
a4d04587 621<em>*% Localize ModelName for French and German</em>
b94498cf 622*fr_CA.Translation ModelName/La Foobar Laser 9999: ""
623*de.Translation ModelName/Foobar LaserDrucken 9999: ""
ef416fc2 624
4744bd90 625*cupsIPPReason com.vendor-error/A serious error occurred: "/help/com.vendor/error.html"
b423cd4c 626<em>*% Localize printer-state-reason for French and German</em>
b94498cf 627*fr_CA.cupsIPPReason com.vendor-error/Une erreur s&egrave;rieuse s'est produite: "/help/com.vendor/error.html"
628*de.cupsIPPReason com.vendor-error/Eine ernste St&ouml;rung trat: "/help/com.vendor/error.html"
b423cd4c 629
ef416fc2 630...
631
632*OpenUI *InputSlot/Paper Source: PickOne
633*OrderDependency: 10 AnySetup *InputSlot
634*DefaultInputSlot: Auto
a4d04587 635<em>*% Localize InputSlot for French and German</em>
b94498cf 636*fr_CA.Translation InputSlot/Papier source: ""
637*de.Translation InputSlot/Papiereinzug: ""
ef416fc2 638*InputSlot Auto/Default: "&lt;&lt;/ManualFeed false&gt;&gt;setpagedevice"
a4d04587 639<em>*% Localize InputSlot=Auto for French and German</em>
b94498cf 640*fr_CA.InputSlot Auto/Par Defaut: ""
641*de.InputSlot Auto/Standard: ""
ef416fc2 642*InputSlot Manual/Manual Feed: "&lt;&lt;/ManualFeed true&gt;&gt;setpagedevice"
a4d04587 643<em>*% Localize InputSlot=Manual for French and German</em>
b94498cf 644*fr_CA.InputSlot Manual/Manuel mecanisme de alimentation: ""
645*de.InputSlot Manual/Manueller Einzug: ""
ef416fc2 646*CloseUI: *InputSlot
647</pre>
648
649
b86bc4cf 650<h2 class='title'><a name='RASTERPS'>Writing PostScript Option Commands for Raster Drivers</a></h2>
651
652<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>
653
654<pre class='command'>
655*PageSize A4: "&lt;&lt;/PageSize[595 842]&gt;&gt;setpagedevice"
656</pre>
657
658<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>
659
660<pre class='command'>
661*CustomWatermarkText True: "&lt;&lt;/cupsString1 3 -1 roll&gt;&gt;setpagedevice"
662</pre>
663
664<p>For a custom string value of "My Watermark", CUPS will produce the following PostScript code for the option:</p>
665
666<pre class='command'>
667(My Watermark)
668&lt;&lt;/cupsString1 3 -1 roll&gt;&gt;setpagedevice
669</pre>
670
671<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>
672
673<pre class='command'>
674&lt;&lt;/cupsString1(My Watermark)&gt;&gt;setpagedevice
675</pre>
676
677<p>The resulting dictionary sets the page device attributes that are sent to your raster driver in the page header.</p>
678
679<h3>Supported PostScript Operators</h3>
680
681<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
683<ul>
684
685 <li><tt>&lt;&lt;</tt> - Start a dictionary.</li>
686
687 <li><tt>&gt;&gt;</tt> - End a dictionary.</li>
688
689 <li><tt>[</tt> - Start an array.</li>
690
691 <li><tt>]</tt> - End an array.</li>
692
693 <li><tt>copy</tt> - Copy the top N objects on the stack.</li>
694
695 <li><tt>dup</tt> - Copy the top object on the stack.</li>
696
697 <li><tt>index</tt> - Copy the Nth from the top object on the stack.</li>
698
699 <li><tt>pop</tt> - Pop the top object on the stack.</li>
700
701 <li><tt>roll</tt> - Shift the top N objects on the stack.</li>
702
703 <li><tt>setpagedevice</tt> - Set the page header values according to the key/value dictionary on the stack.</li>
704
705</ul>
706
707<h3>Supported Page Device Attributes</h3>
708
709<p>Table 1 shows the supported page device attributes along with PostScript code examples.</p>
710
711<div class='table'>
712<table summary='Supported Page Device Attributes'>
713<caption>Table 1: <a name='TABLE_1'>Supported Page Device Attributes</a></caption>
714<thead>
715<tr>
716 <th>Name(s)</th>
717 <th>Type</th>
718 <th>Description</th>
719 <th>Example(s)</th>
720</tr>
721</thead>
722<tbody>
723<tr valign='top'>
724 <td><tt>AdvanceDistance</tt></td>
725 <td>Integer</td>
726 <td>Specifies the number of points to advance roll media after printing.</td>
727 <td><tt>&lt;&lt;/AdvanceDistance 18&gt;&gt;setpagedevice</tt></td>
728</tr>
729<tr valign='top'>
730 <td><tt>AdvanceMedia</tt></td>
731 <td>Integer</td>
732 <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>
733 <td><tt>&lt;&lt;/AdvanceMedia 4&gt;&gt;setpagedevice</tt></td>
734</tr>
735<tr valign='top'>
736 <td><tt>Collate</tt></td>
737 <td>Boolean</td>
738 <td>Specifies whether collated copies are required.</td>
739 <td><tt>&lt;&lt;/Collate true&gt;&gt;setpagedevice</tt></td>
740</tr>
741<tr valign='top'>
742 <td><tt>CutMedia</tt></td>
743 <td>Integer</td>
744 <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>
745 <td><tt>&lt;&lt;/CutMedia 1&gt;&gt;setpagedevice</tt></td>
746</tr>
747<tr valign='top'>
748 <td><tt>Duplex</tt></td>
749 <td>Boolean</td>
750 <td>Specifies whether 2-sided printing is required.</td>
751 <td><tt>&lt;&lt;/Duplex true&gt;&gt;setpagedevice</tt></td>
752</tr>
753<tr valign='top'>
754 <td><tt>HWResolution</tt></td>
755 <td>Integer Array</td>
756 <td>Specifies the resolution of the page image in pixels per inch.</td>
757 <td><tt>&lt;&lt;/HWResolution[1200 1200]&gt;&gt;setpagedevice</tt></td>
758</tr>
759<tr valign='top'>
760 <td><tt>InsertSheet</tt></td>
761 <td>Boolean</td>
762 <td>Specifies whether to insert a blank sheet before the job.</td>
763 <td><tt>&lt;&lt;/InsertSheet true&gt;&gt;setpagedevice</tt></td>
764</tr>
765<tr valign='top'>
766 <td><tt>Jog</tt></td>
767 <td>Integer</td>
768 <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>
769 <td><tt>&lt;&lt;/Jog 2&gt;&gt;setpagedevice</tt></td>
770</tr>
771<tr valign='top'>
772 <td><tt>LeadingEdge</tt></td>
773 <td>Integer</td>
774 <td>Specifies the leading edge of the media: 0 = top, 1 = right, 2 = bottom, 3 = left.</td>
775 <td><tt>&lt;&lt;/LeadingEdge 0&gt;&gt;setpagedevice</tt></td>
776</tr>
777<tr valign='top'>
778 <td><tt>ManualFeed</tt></td>
779 <td>Boolean</td>
780 <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>
781 <td><tt>&lt;&lt;/ManualFeed true&gt;&gt;setpagedevice</tt></td>
782</tr>
783<tr valign='top'>
784 <td><tt>MediaClass</tt></td>
785 <td>String</td>
786 <td>Specifies a named media.</td>
787 <td><tt>&lt;&lt;/MediaClass (Invoices)&gt;&gt;setpagedevice</tt></td>
788</tr>
789<tr valign='top'>
790 <td><tt>MediaColor</tt></td>
791 <td>String</td>
792 <td>Specifies the color of the media.</td>
793 <td><tt>&lt;&lt;/MediaColor &gt;&gt;setpagedevice</tt></td>
794</tr>
795<tr valign='top'>
796 <td><tt>MediaPosition</tt></td>
797 <td>Integer</td>
798 <td>Specifies the tray or source of the media.</td>
799 <td><tt>&lt;&lt;/MediaPosition 12&gt;&gt;setpagedevice</tt></td>
800</tr>
801<tr valign='top'>
802 <td><tt>MediaType</tt></td>
803 <td>String</td>
804 <td>Specifies the general media type.</td>
805 <td><tt>&lt;&lt;/MediaType (Glossy)&gt;&gt;setpagedevice</tt></td>
806</tr>
807<tr valign='top'>
808 <td><tt>MediaWeight</tt></td>
809 <td>Integer</td>
810 <td>Specifies the media weight in grams per meter<sup>2</sup>.</td>
811 <td><tt>&lt;&lt;/MediaWeight 100&gt;&gt;setpagedevice</tt></td>
812</tr>
813<tr valign='top'>
814 <td><tt>MirrorPrint</tt></td>
815 <td>Boolean</td>
816 <td>Specifies whether to flip the output image horizontally.</td>
817 <td><tt>&lt;&lt;/MirrorPrint true&gt;&gt;setpagedevice</tt></td>
818</tr>
819<tr valign='top'>
820 <td><tt>NegativePrint</tt></td>
821 <td>Boolean</td>
822 <td>Specifies whether to invert the output image.</td>
823 <td><tt>&lt;&lt;/NegativePrint true&gt;&gt;setpagedevice</tt></td>
824</tr>
825<tr valign='top'>
826 <td><tt>NumCopies</tt></td>
827 <td>Integer</td>
828 <td>Specifies the number of copies to produce of each page.</td>
829 <td><tt>&lt;&lt;/NumCopies 100&gt;&gt;setpagedevice</tt></td>
830</tr>
831<tr valign='top'>
832 <td><tt>Orientation</tt></td>
833 <td>Integer</td>
834 <td>Specifies the orientation of the output: 0 = portrait, 1 = landscape rotated counter-clockwise, 2 = upside-down, 3 = landscape rotated clockwise.</td>
835 <td><tt>&lt;&lt;/Orientation 3&gt;&gt;setpagedevice</tt></td>
836</tr>
837<tr valign='top'>
838 <td><tt>OutputFaceUp</tt></td>
839 <td>Boolean</td>
840 <td>Specifies whether to place the media face-up in the output bin/tray.</td>
841 <td><tt>&lt;&lt;/OutputFaceUp true&gt;&gt;setpagedevice</tt></td>
842</tr>
843<tr valign='top'>
844 <td><tt>OutputType</tt></td>
845 <td>String</td>
846 <td>Specifies the output type name.</td>
847 <td><tt>&lt;&lt;/OutputType (Photo)&gt;&gt;setpagedevice</tt></td>
848</tr>
849<tr valign='top'>
850 <td><tt>PageSize</tt></td>
851 <td>Integer/Real Array</td>
852 <td>Specifies the width and length/height of the page in points.</td>
853 <td><tt>&lt;&lt;/PageSize[595 842]&gt;&gt;setpagedevice</tt></td>
854</tr>
855<tr valign='top'>
856 <td><tt>Separations</tt></td>
857 <td>Boolean</td>
858 <td>Specifies whether to produce color separations.</td>
859 <td><tt>&lt;&lt;/Separations true&gt;&gt;setpagedevice</tt></td>
860</tr>
861<tr valign='top'>
862 <td><tt>TraySwitch</tt></td>
863 <td>Boolean</td>
864 <td>Specifies whether to switch trays automatically.</td>
865 <td><tt>&lt;&lt;/TraySwitch true&gt;&gt;setpagedevice</tt></td>
866</tr>
867<tr valign='top'>
868 <td><tt>Tumble</tt></td>
869 <td>Boolean</td>
870 <td>Specifies whether the back sides of pages are rotated 180 degrees.</td>
871 <td><tt>&lt;&lt;/Tumble true&gt;&gt;setpagedevice</tt></td>
872</tr>
873<tr valign='top'>
874 <td><tt>cupsBorderlessScalingFactor</tt></td>
875 <td>Real</td>
876 <td>Specifies the amount to scale the page image dimensions.</td>
877 <td><tt>&lt;&lt;/cupsBorderlessScalingFactor 1.01&gt;&gt;setpagedevice</tt></td>
878</tr>
879<tr valign='top'>
880 <td><tt>cupsColorOrder</tt></td>
881 <td>Integer</td>
882 <td>Specifies the order of colors: 0 = chunked, 1 = banded, 2 = planar.</td>
883 <td><tt>&lt;&lt;/cupsColorOrder 0&gt;&gt;setpagedevice</tt></td>
884</tr>
885<tr valign='top'>
886 <td><tt>cupsColorSpace</tt></td>
887 <td>Integer</td>
888 <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>
889 <td><tt>&lt;&lt;/cupsColorSpace &gt;&gt;setpagedevice</tt></td>
890</tr>
891<tr valign='top'>
892 <td><tt>cupsCompression</tt></td>
893 <td>Integer</td>
894 <td>Specifies a driver compression type/mode.</td>
895 <td><tt>&lt;&lt;/cupsCompression 2&gt;&gt;setpagedevice</tt></td>
896</tr>
897<tr valign='top'>
898 <td><tt>cupsInteger0<br>
899 ...<br>
900 cupsInteger15</tt></td>
901 <td>Integer</td>
902 <td>Specifies driver integer values.</td>
903 <td><tt>&lt;&lt;/cupsInteger11 1234&gt;&gt;setpagedevice</tt></td>
904</tr>
905<tr valign='top'>
906 <td><tt>cupsMarkerType</tt></td>
907 <td>String</td>
908 <td>Specifies the type of ink/toner to use.</td>
909 <td><tt>&lt;&lt;/cupsMarkerType (Black+Color)&gt;&gt;setpagedevice</tt></td>
910</tr>
911<tr valign='top'>
912 <td><tt>cupsMediaType</tt></td>
913 <td>Integer</td>
914 <td>Specifies a numeric media type.</td>
915 <td><tt>&lt;&lt;/cupsMediaType 999&gt;&gt;setpagedevice</tt></td>
916</tr>
917<tr valign='top'>
918 <td><tt>cupsPageSizeName</tt></td>
919 <td>String</td>
920 <td>Specifies the name of the page size.</td>
921 <td><tt>&lt;&lt;/cupsPageSizeName (A4.Full)&gt;&gt;setpagedevice</tt></td>
922</tr>
923<tr valign='top'>
924 <td><tt>cupsPreferredBitsPerColor</tt></td>
925 <td>Integer</td>
926 <td>Specifies the preferred number of bits per color, typically 8 or 16.</td>
927 <td><tt>&lt;&lt;/cupsPreferredBitsPerColor 16&gt;&gt;setpagedevice</tt></td>
928</tr>
929<tr valign='top'>
930 <td><tt>cupsReal0<br>
931 ...<br>
932 cupsReal15</tt></td>
933 <td>Real</td>
934 <td>Specifies driver real number values.</td>
935 <td><tt>&lt;&lt;/cupsReal15 1.234&gt;&gt;setpagedevice</tt></td>
936</tr>
937<tr valign='top'>
938 <td><tt>cupsRenderingIntent</tt></td>
939 <td>String</td>
940 <td>Specifies the color rendering intent.</td>
941 <td><tt>&lt;&lt;/cupsRenderingIntent (AbsoluteColorimetric)&gt;&gt;setpagedevice</tt></td>
942</tr>
943<tr valign='top'>
944 <td><tt>cupsRowCount</tt></td>
945 <td>Integer</td>
946 <td>Specifies the number of rows of raster data to print on each line for some drivers.</td>
947 <td><tt>&lt;&lt;/cupsRowCount 24&gt;&gt;setpagedevice</tt></td>
948</tr>
949<tr valign='top'>
950 <td><tt>cupsRowFeed</tt></td>
951 <td>Integer</td>
952 <td>Specifies the number of rows to feed between passes for some drivers.</td>
953 <td><tt>&lt;&lt;/cupsRowFeed 17&gt;&gt;setpagedevice</tt></td>
954</tr>
955<tr valign='top'>
956 <td><tt>cupsRowStep</tt></td>
957 <td>Integer</td>
958 <td>Specifies the number of lines between columns/rows on the print head for some drivers.</td>
959 <td><tt>&lt;&lt;/cupsRowStep 2&gt;&gt;setpagedevice</tt></td>
960</tr>
961<tr valign='top'>
962 <td><tt>cupsString0<br>
963 ...<br>
964 cupsString15</tt></td>
965 <td>String</td>
966 <td>Specifies driver string values.</td>
967 <td><tt>&lt;&lt;/cupsString0(String Value)&gt;&gt;setpagedevice</tt></td>
968</tr>
969</tbody>
970</table></div>
971
972
ef416fc2 973<h2 class='title'><a name='HISTORY'>Change History</a></h2>
974
f7deaa1a 975<h3>Changes in CUPS 1.3</h3>
976
977<ul>
978
979 <li>Added <tt>cupsPreFilter</tt> attribute.</li>
980
981</ul>
982
b86bc4cf 983<h3>Changes in CUPS 1.2.8</h3>
984
985<ul>
986
987 <li>Added section on supported PostScript commands for raster
988 drivers</li>
989
990</ul>
991
ef416fc2 992<h3>Changes in CUPS 1.2</h3>
993
994<ul>
995
ecdc0628 996 <li>Added globalization support attributes</li>
ef416fc2 997
998 <li>Added custom option values support</li>
999
4744bd90 1000 <li>Added <tt>APBookFile</tt> attribute</li>
1001
a4d04587 1002 <li>Added <tt>APDuplexRequiresFlippedMargin</tt> attribute</li>
1003
ef416fc2 1004 <li>Added <tt>cupsICCProfile</tt> attribute</li>
1005
4744bd90 1006 <li>Added <tt>cupsIPPReason</tt> attribute</li>
1007
a4d04587 1008 <li>Added <tt>cupsLanguages</tt> attribute</li>
1009
ef416fc2 1010 <li>Added <tt>cupsPortMonitor</tt> attribute</li>
1011
1012 <li>Removed <tt>cupsProtocol</tt> attribute</li>
1013
1014</ul>
1015
1016<h3>Changes in CUPS 1.1</h3>
1017
1018<ul>
1019
1020 <li>Added <tt>cupsFlipDuplex</tt> attribute</li>
1021
1022 <li>Added <tt>cupsProtocol</tt> attribute</li>
1023
1024</ul>
1025
1026</body>
1027</html>