]> git.ipfire.org Git - thirdparty/cups.git/blob - doc/help/spec-ppd.html
Load cups into easysw/current.
[thirdparty/cups.git] / doc / help / spec-ppd.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2 <html>
3 <!-- SECTION: Specifications -->
4 <head>
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'>
8 </head>
9 <body>
10 <!--
11 "$Id: spec-ppd.html 6252 2007-02-10 15:34:18Z mike $"
12
13 CUPS PPD extensions specification for the Common UNIX Printing System (CUPS).
14
15 Copyright 1997-2007 by Easy Software Products.
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
37 that CUPS adds to <a
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
43 filtering.</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
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
51 file:</p>
52
53 <pre class='command'>
54 PPD-FILE = HEADER +(DATA / COMMENT / LINE-END)
55
56 HEADER = "*" 0x50.50.44.2D.41.64.6F.62.65 ":" ; *PPD-Adobe:
57 *WSP DQUOTE "4.3" DQUOTE LINE-END
58
59 COMMENT = "*%" *TCHAR LINE-END
60
61 DATA = "*" 1*KCHAR [ WSP 1*KCHAR [ "/" 1*TCHAR ] ] ":"
62 1*(*WSP VALUE) LINE-END
63
64 VALUE = 1*TCHAR / DQUOTE 1*SCHAR DQUOTE
65
66 KCHAR = ALPHA / DIGIT / "_" / "." / "-"
67
68 SCHAR = LINE-END / WSP / %x21 / %x23-7E / %xA0-FF
69
70 TCHAR = %x20-7E / %xA0-FF
71
72 LINE-END = CR / LF / CR LF
73 </pre>
74
75
76 <h2 class='title'><a name='ATTRIBUTES'>General Attributes</a></h2>
77
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
83 for 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
91 <h3>APDuplexRequiresFlippedMargin</h3>
92
93 <p class='summary'>*APDuplexRequiresFlippedMargin: boolean</p>
94
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>
99
100 <p>Example:</p>
101
102 <pre class='command'>
103 <em>*% Flip the back side images</em>
104 *cupsFlipDuplex: true
105
106 <em>*% Don't swap the top and bottom margins for the back side</em>
107 *APDuplexRequiresFlippedMargin: false
108 </pre>
109
110 <p>Also see the related <tt>cupsFlipDuplex</tt> attribute.</p>
111
112 <h3>cupsEvenDuplex</h3>
113
114 <p class='summary'>*cupsEvenDuplex: boolean</p>
115
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>
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
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
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>
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
151 <p class='summary'>*cupsFlipDuplex: boolean</p>
152
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>
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
164 <p>Also see the related <tt>APDuplexRequiresFlippedMargins</tt>
165 attribute.</p>
166
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
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>
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
196 help:anchor='com.vendor-error'%20bookID=Vendor%20Help
197 http://www.vendor.com/help"
198 *End
199 </pre>
200
201 <h3>cupsLanguages</h3>
202
203 <p class='summary'>*cupsLanguages: "locale list"</p>
204
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>
208
209 <p>Example:</p>
210
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"
214 </pre>
215
216 <h3>cupsManualCopies</h3>
217
218 <p class='summary'>*cupsManualCopies: boolean</p>
219
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>
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
233 <p class='summary'>*cupsModelNumber: number</p>
234
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>
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
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
252 for strings in PJL commands. If not specified, US-ASCII is
253 assumed.</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
263 <h3>cupsPortMonitor</h3>
264
265 <p class='summary'>*cupsPortMonitor urischeme/Descriptive Text: "port monitor"</p>
266
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>
274
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>
280
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
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
291 <em>*% Specify a printer-specific port monitor for an Epson USB printer</em>
292 *cupsPortMonitor usb/USB Status Monitor: "epson-usb"
293 </pre>
294
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
300 program will be inserted in the conversion chain immediately
301 before 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
313 <h3>cupsVersion</h3>
314
315 <p class='summary'>*cupsVersion: major.minor</p>
316
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>
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
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>
332 syntax:</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,
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>
349
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 "&lt;&lt;/cupsReal1 2 1 roll&gt;&gt;setpagedevice" and the
355 option value is "2.0" then CUPS will output the string
356 "2.0 &lt;&lt;/cupsReal1 2 1 roll&gt;&gt;setpagedevice".</p>
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"
375 numbers ("minimum" and "maximum" are numbers and passcode
376 strings are not displayed in the user interface)</li>
377
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>
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"
391 characters ("minimum" and "maximum" are numbers)</li>
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
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>
422 *CustomWatermarkText True: "&lt;&lt;/cupsString1 3 -1 roll&gt;&gt;setpagedevice"
423 *ParamCustomWatermarkText Text: 1 string 0 32
424
425
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"
433 *CloseUI: *GammaDensity
434
435 <em>*% Custom PostScript gamma/density option</em>
436 *CustomGammaDensity True: "&lt;&lt;/cupsReal1 3 -1 roll/cupsReal2 5 -1&gt;&gt;setpagedevice"
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
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>
448
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>
452
453 <h3>cupsColorProfile</h3>
454
455 <p class='summary'>*cupsColorProfile Resolution/MediaType: "density
456 gamma m00 m01 m02 m10 m11 m12 m20 m21 m22"</p>
457
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>
461
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
465 the PPD file.</p>
466
467 <p>The <i>density</i> and <i>gamma</i> values define gamma and
468 density adjustment function such that:</p>
469
470 <pre class='command'>
471 f(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
475 transformation matrix for the CMY color values. The density
476 function 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
499 <p class='summary'>*cupsICCProfile
500 ColorModel.MediaType.Resolution/Description: "filename"</p>
501
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>
508
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>
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>
525 *cupsICCProfile ../Default: "vendor/foo-default.icc"
526 </pre>
527
528 <h4>Customizing the Profile Selection Keywords</h4>
529
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>
535
536 <pre class='command'>
537 *cupsICCQualifier2: MainKeyword2
538 *cupsICCQualifier3: MainKeyword3
539 </pre>
540
541 <p>The default mapping is as follows:</p>
542
543 <pre class='command'>
544 *cupsICCQualifier2: MediaType
545 *cupsICCQualifier3: Resolution
546 </pre>
547
548
549 <h2 class='title'><a name='I18N'>Globalized PPD Support</a></h2>
550
551 <p>CUPS 1.2 and higher adds support for PPD files containing multiple
552 languages by following the following additional rules:</p>
553
554 <ol>
555
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>
566
567 <li>The main keyword "Translation" MUST NOT be used</li>
568
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>
574
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
578 code</li>
579
580 <li>Locale-specific translation strings MUST be encoded
581 using UTF-8.</li>
582
583 <li>Main keywords MUST be localized using one of the
584 following forms:
585 <p><tt>*ll.Translation MainKeyword/translation
586 text: ""</tt><br />
587 <tt>*ll_CC.Translation MainKeyword/translation
588 text: ""</tt></p></li>
589
590 <li>Option keywords MUST be localized using one of the
591 following forms:
592 <p><tt>*ll.MainKeyword OptionKeyword/translation
593 text: ""</tt><br />
594 <tt>*ll_CC.MainKeyword OptionKeyword/translation
595 text: ""</tt></p></li>
596
597 <li>Localization attributes MAY appear anywhere after the
598 first line of the PPD file</li>
599
600 </ol>
601
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>
609
610 <p>Examples:</p>
611
612 <pre class='command'>
613 *LanguageVersion: English
614 *LanguageEncoding: ISOLatin1
615 *cupsLanguages: "de_DE fr_FR"
616 *ModelName: "Foobar Laser 9999"
617
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: ""
621
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&egrave;rieuse s'est produite: "/help/com.vendor/error.html"
625 *de_DE.cupsIPPReason com.vendor-error/Eine ernste St&ouml;rung trat: "/help/com.vendor/error.html"
626
627 ...
628
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: "&lt;&lt;/ManualFeed false&gt;&gt;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: "&lt;&lt;/ManualFeed true&gt;&gt;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: ""
643 *CloseUI: *InputSlot
644 </pre>
645
646
647 <h2 class='title'><a name='RASTERPS'>Writing PostScript Option Commands for Raster Drivers</a></h2>
648
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>
650
651 <pre class='command'>
652 *PageSize A4: "&lt;&lt;/PageSize[595 842]&gt;&gt;setpagedevice"
653 </pre>
654
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>
656
657 <pre class='command'>
658 *CustomWatermarkText True: "&lt;&lt;/cupsString1 3 -1 roll&gt;&gt;setpagedevice"
659 </pre>
660
661 <p>For a custom string value of "My Watermark", CUPS will produce the following PostScript code for the option:</p>
662
663 <pre class='command'>
664 (My Watermark)
665 &lt;&lt;/cupsString1 3 -1 roll&gt;&gt;setpagedevice
666 </pre>
667
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>
669
670 <pre class='command'>
671 &lt;&lt;/cupsString1(My Watermark)&gt;&gt;setpagedevice
672 </pre>
673
674 <p>The resulting dictionary sets the page device attributes that are sent to your raster driver in the page header.</p>
675
676 <h3>Supported PostScript Operators</h3>
677
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>
679
680 <ul>
681
682 <li><tt>&lt;&lt;</tt> - Start a dictionary.</li>
683
684 <li><tt>&gt;&gt;</tt> - End a dictionary.</li>
685
686 <li><tt>[</tt> - Start an array.</li>
687
688 <li><tt>]</tt> - End an array.</li>
689
690 <li><tt>copy</tt> - Copy the top N objects on the stack.</li>
691
692 <li><tt>dup</tt> - Copy the top object on the stack.</li>
693
694 <li><tt>index</tt> - Copy the Nth from the top object on the stack.</li>
695
696 <li><tt>pop</tt> - Pop the top object on the stack.</li>
697
698 <li><tt>roll</tt> - Shift the top N objects on the stack.</li>
699
700 <li><tt>setpagedevice</tt> - Set the page header values according to the key/value dictionary on the stack.</li>
701
702 </ul>
703
704 <h3>Supported Page Device Attributes</h3>
705
706 <p>Table 1 shows the supported page device attributes along with PostScript code examples.</p>
707
708 <div class='table'>
709 <table summary='Supported Page Device Attributes'>
710 <caption>Table 1: <a name='TABLE_1'>Supported Page Device Attributes</a></caption>
711 <thead>
712 <tr>
713 <th>Name(s)</th>
714 <th>Type</th>
715 <th>Description</th>
716 <th>Example(s)</th>
717 </tr>
718 </thead>
719 <tbody>
720 <tr valign='top'>
721 <td><tt>AdvanceDistance</tt></td>
722 <td>Integer</td>
723 <td>Specifies the number of points to advance roll media after printing.</td>
724 <td><tt>&lt;&lt;/AdvanceDistance 18&gt;&gt;setpagedevice</tt></td>
725 </tr>
726 <tr valign='top'>
727 <td><tt>AdvanceMedia</tt></td>
728 <td>Integer</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>&lt;&lt;/AdvanceMedia 4&gt;&gt;setpagedevice</tt></td>
731 </tr>
732 <tr valign='top'>
733 <td><tt>Collate</tt></td>
734 <td>Boolean</td>
735 <td>Specifies whether collated copies are required.</td>
736 <td><tt>&lt;&lt;/Collate true&gt;&gt;setpagedevice</tt></td>
737 </tr>
738 <tr valign='top'>
739 <td><tt>CutMedia</tt></td>
740 <td>Integer</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>&lt;&lt;/CutMedia 1&gt;&gt;setpagedevice</tt></td>
743 </tr>
744 <tr valign='top'>
745 <td><tt>Duplex</tt></td>
746 <td>Boolean</td>
747 <td>Specifies whether 2-sided printing is required.</td>
748 <td><tt>&lt;&lt;/Duplex true&gt;&gt;setpagedevice</tt></td>
749 </tr>
750 <tr valign='top'>
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>&lt;&lt;/HWResolution[1200 1200]&gt;&gt;setpagedevice</tt></td>
755 </tr>
756 <tr valign='top'>
757 <td><tt>InsertSheet</tt></td>
758 <td>Boolean</td>
759 <td>Specifies whether to insert a blank sheet before the job.</td>
760 <td><tt>&lt;&lt;/InsertSheet true&gt;&gt;setpagedevice</tt></td>
761 </tr>
762 <tr valign='top'>
763 <td><tt>Jog</tt></td>
764 <td>Integer</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>&lt;&lt;/Jog 2&gt;&gt;setpagedevice</tt></td>
767 </tr>
768 <tr valign='top'>
769 <td><tt>LeadingEdge</tt></td>
770 <td>Integer</td>
771 <td>Specifies the leading edge of the media: 0 = top, 1 = right, 2 = bottom, 3 = left.</td>
772 <td><tt>&lt;&lt;/LeadingEdge 0&gt;&gt;setpagedevice</tt></td>
773 </tr>
774 <tr valign='top'>
775 <td><tt>ManualFeed</tt></td>
776 <td>Boolean</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>&lt;&lt;/ManualFeed true&gt;&gt;setpagedevice</tt></td>
779 </tr>
780 <tr valign='top'>
781 <td><tt>MediaClass</tt></td>
782 <td>String</td>
783 <td>Specifies a named media.</td>
784 <td><tt>&lt;&lt;/MediaClass (Invoices)&gt;&gt;setpagedevice</tt></td>
785 </tr>
786 <tr valign='top'>
787 <td><tt>MediaColor</tt></td>
788 <td>String</td>
789 <td>Specifies the color of the media.</td>
790 <td><tt>&lt;&lt;/MediaColor &gt;&gt;setpagedevice</tt></td>
791 </tr>
792 <tr valign='top'>
793 <td><tt>MediaPosition</tt></td>
794 <td>Integer</td>
795 <td>Specifies the tray or source of the media.</td>
796 <td><tt>&lt;&lt;/MediaPosition 12&gt;&gt;setpagedevice</tt></td>
797 </tr>
798 <tr valign='top'>
799 <td><tt>MediaType</tt></td>
800 <td>String</td>
801 <td>Specifies the general media type.</td>
802 <td><tt>&lt;&lt;/MediaType (Glossy)&gt;&gt;setpagedevice</tt></td>
803 </tr>
804 <tr valign='top'>
805 <td><tt>MediaWeight</tt></td>
806 <td>Integer</td>
807 <td>Specifies the media weight in grams per meter<sup>2</sup>.</td>
808 <td><tt>&lt;&lt;/MediaWeight 100&gt;&gt;setpagedevice</tt></td>
809 </tr>
810 <tr valign='top'>
811 <td><tt>MirrorPrint</tt></td>
812 <td>Boolean</td>
813 <td>Specifies whether to flip the output image horizontally.</td>
814 <td><tt>&lt;&lt;/MirrorPrint true&gt;&gt;setpagedevice</tt></td>
815 </tr>
816 <tr valign='top'>
817 <td><tt>NegativePrint</tt></td>
818 <td>Boolean</td>
819 <td>Specifies whether to invert the output image.</td>
820 <td><tt>&lt;&lt;/NegativePrint true&gt;&gt;setpagedevice</tt></td>
821 </tr>
822 <tr valign='top'>
823 <td><tt>NumCopies</tt></td>
824 <td>Integer</td>
825 <td>Specifies the number of copies to produce of each page.</td>
826 <td><tt>&lt;&lt;/NumCopies 100&gt;&gt;setpagedevice</tt></td>
827 </tr>
828 <tr valign='top'>
829 <td><tt>Orientation</tt></td>
830 <td>Integer</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>&lt;&lt;/Orientation 3&gt;&gt;setpagedevice</tt></td>
833 </tr>
834 <tr valign='top'>
835 <td><tt>OutputFaceUp</tt></td>
836 <td>Boolean</td>
837 <td>Specifies whether to place the media face-up in the output bin/tray.</td>
838 <td><tt>&lt;&lt;/OutputFaceUp true&gt;&gt;setpagedevice</tt></td>
839 </tr>
840 <tr valign='top'>
841 <td><tt>OutputType</tt></td>
842 <td>String</td>
843 <td>Specifies the output type name.</td>
844 <td><tt>&lt;&lt;/OutputType (Photo)&gt;&gt;setpagedevice</tt></td>
845 </tr>
846 <tr valign='top'>
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>&lt;&lt;/PageSize[595 842]&gt;&gt;setpagedevice</tt></td>
851 </tr>
852 <tr valign='top'>
853 <td><tt>Separations</tt></td>
854 <td>Boolean</td>
855 <td>Specifies whether to produce color separations.</td>
856 <td><tt>&lt;&lt;/Separations true&gt;&gt;setpagedevice</tt></td>
857 </tr>
858 <tr valign='top'>
859 <td><tt>TraySwitch</tt></td>
860 <td>Boolean</td>
861 <td>Specifies whether to switch trays automatically.</td>
862 <td><tt>&lt;&lt;/TraySwitch true&gt;&gt;setpagedevice</tt></td>
863 </tr>
864 <tr valign='top'>
865 <td><tt>Tumble</tt></td>
866 <td>Boolean</td>
867 <td>Specifies whether the back sides of pages are rotated 180 degrees.</td>
868 <td><tt>&lt;&lt;/Tumble true&gt;&gt;setpagedevice</tt></td>
869 </tr>
870 <tr valign='top'>
871 <td><tt>cupsBorderlessScalingFactor</tt></td>
872 <td>Real</td>
873 <td>Specifies the amount to scale the page image dimensions.</td>
874 <td><tt>&lt;&lt;/cupsBorderlessScalingFactor 1.01&gt;&gt;setpagedevice</tt></td>
875 </tr>
876 <tr valign='top'>
877 <td><tt>cupsColorOrder</tt></td>
878 <td>Integer</td>
879 <td>Specifies the order of colors: 0 = chunked, 1 = banded, 2 = planar.</td>
880 <td><tt>&lt;&lt;/cupsColorOrder 0&gt;&gt;setpagedevice</tt></td>
881 </tr>
882 <tr valign='top'>
883 <td><tt>cupsColorSpace</tt></td>
884 <td>Integer</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>&lt;&lt;/cupsColorSpace &gt;&gt;setpagedevice</tt></td>
887 </tr>
888 <tr valign='top'>
889 <td><tt>cupsCompression</tt></td>
890 <td>Integer</td>
891 <td>Specifies a driver compression type/mode.</td>
892 <td><tt>&lt;&lt;/cupsCompression 2&gt;&gt;setpagedevice</tt></td>
893 </tr>
894 <tr valign='top'>
895 <td><tt>cupsInteger0<br>
896 ...<br>
897 cupsInteger15</tt></td>
898 <td>Integer</td>
899 <td>Specifies driver integer values.</td>
900 <td><tt>&lt;&lt;/cupsInteger11 1234&gt;&gt;setpagedevice</tt></td>
901 </tr>
902 <tr valign='top'>
903 <td><tt>cupsMarkerType</tt></td>
904 <td>String</td>
905 <td>Specifies the type of ink/toner to use.</td>
906 <td><tt>&lt;&lt;/cupsMarkerType (Black+Color)&gt;&gt;setpagedevice</tt></td>
907 </tr>
908 <tr valign='top'>
909 <td><tt>cupsMediaType</tt></td>
910 <td>Integer</td>
911 <td>Specifies a numeric media type.</td>
912 <td><tt>&lt;&lt;/cupsMediaType 999&gt;&gt;setpagedevice</tt></td>
913 </tr>
914 <tr valign='top'>
915 <td><tt>cupsPageSizeName</tt></td>
916 <td>String</td>
917 <td>Specifies the name of the page size.</td>
918 <td><tt>&lt;&lt;/cupsPageSizeName (A4.Full)&gt;&gt;setpagedevice</tt></td>
919 </tr>
920 <tr valign='top'>
921 <td><tt>cupsPreferredBitsPerColor</tt></td>
922 <td>Integer</td>
923 <td>Specifies the preferred number of bits per color, typically 8 or 16.</td>
924 <td><tt>&lt;&lt;/cupsPreferredBitsPerColor 16&gt;&gt;setpagedevice</tt></td>
925 </tr>
926 <tr valign='top'>
927 <td><tt>cupsReal0<br>
928 ...<br>
929 cupsReal15</tt></td>
930 <td>Real</td>
931 <td>Specifies driver real number values.</td>
932 <td><tt>&lt;&lt;/cupsReal15 1.234&gt;&gt;setpagedevice</tt></td>
933 </tr>
934 <tr valign='top'>
935 <td><tt>cupsRenderingIntent</tt></td>
936 <td>String</td>
937 <td>Specifies the color rendering intent.</td>
938 <td><tt>&lt;&lt;/cupsRenderingIntent (AbsoluteColorimetric)&gt;&gt;setpagedevice</tt></td>
939 </tr>
940 <tr valign='top'>
941 <td><tt>cupsRowCount</tt></td>
942 <td>Integer</td>
943 <td>Specifies the number of rows of raster data to print on each line for some drivers.</td>
944 <td><tt>&lt;&lt;/cupsRowCount 24&gt;&gt;setpagedevice</tt></td>
945 </tr>
946 <tr valign='top'>
947 <td><tt>cupsRowFeed</tt></td>
948 <td>Integer</td>
949 <td>Specifies the number of rows to feed between passes for some drivers.</td>
950 <td><tt>&lt;&lt;/cupsRowFeed 17&gt;&gt;setpagedevice</tt></td>
951 </tr>
952 <tr valign='top'>
953 <td><tt>cupsRowStep</tt></td>
954 <td>Integer</td>
955 <td>Specifies the number of lines between columns/rows on the print head for some drivers.</td>
956 <td><tt>&lt;&lt;/cupsRowStep 2&gt;&gt;setpagedevice</tt></td>
957 </tr>
958 <tr valign='top'>
959 <td><tt>cupsString0<br>
960 ...<br>
961 cupsString15</tt></td>
962 <td>String</td>
963 <td>Specifies driver string values.</td>
964 <td><tt>&lt;&lt;/cupsString0(String Value)&gt;&gt;setpagedevice</tt></td>
965 </tr>
966 </tbody>
967 </table></div>
968
969
970 <h2 class='title'><a name='HISTORY'>Change History</a></h2>
971
972 <h3>Changes in CUPS 1.3</h3>
973
974 <ul>
975
976 <li>Added <tt>cupsPreFilter</tt> attribute.</li>
977
978 </ul>
979
980 <h3>Changes in CUPS 1.2.8</h3>
981
982 <ul>
983
984 <li>Added section on supported PostScript commands for raster
985 drivers</li>
986
987 </ul>
988
989 <h3>Changes in CUPS 1.2</h3>
990
991 <ul>
992
993 <li>Added globalization support attributes</li>
994
995 <li>Added custom option values support</li>
996
997 <li>Added <tt>APBookFile</tt> attribute</li>
998
999 <li>Added <tt>APDuplexRequiresFlippedMargin</tt> attribute</li>
1000
1001 <li>Added <tt>cupsICCProfile</tt> attribute</li>
1002
1003 <li>Added <tt>cupsIPPReason</tt> attribute</li>
1004
1005 <li>Added <tt>cupsLanguages</tt> attribute</li>
1006
1007 <li>Added <tt>cupsPortMonitor</tt> attribute</li>
1008
1009 <li>Removed <tt>cupsProtocol</tt> attribute</li>
1010
1011 </ul>
1012
1013 <h3>Changes in CUPS 1.1</h3>
1014
1015 <ul>
1016
1017 <li>Added <tt>cupsFlipDuplex</tt> attribute</li>
1018
1019 <li>Added <tt>cupsProtocol</tt> attribute</li>
1020
1021 </ul>
1022
1023 </body>
1024 </html>