]> git.ipfire.org Git - thirdparty/cups.git/blame - doc/help/ppd-compiler.html
Merge changes from CUPS 1.5svn-r9407.
[thirdparty/cups.git] / doc / help / ppd-compiler.html
CommitLineData
745129be 1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
8b450588 2<html>
28b9d139 3<!-- SECTION: Programming -->
8b450588
MS
4<head>
5<title>Introduction to the PPD Compiler</title>
6<meta name="keywords" content="Programming">
c779abb0 7<meta name="creator" content="Mini-XML v2.7">
8b450588
MS
8<style type="text/css"><!--
9BODY {
10 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
11}
12
13H1, H2, H3, H4, H5, H6, P, TD, TH {
14 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
15}
16
17KBD {
18 font-family: monaco, courier, monospace;
19 font-weight: bold;
20}
21
22PRE {
23 font-family: monaco, courier, monospace;
24}
25
26PRE.command {
10d09e33 27 border: dotted thin #7f7f7f;
8b450588 28 margin-left: 36pt;
10d09e33 29 padding: 10px;
8b450588
MS
30}
31
f11a948a
MS
32P.compact {
33 margin: 0;
34}
35
8b450588
MS
36P.example {
37 font-style: italic;
38 margin-left: 36pt;
39}
40
41PRE.example {
42 background: #eeeeee;
43 border: dotted thin #999999;
44 margin-left: 36pt;
178cb736 45 padding: 10pt;
8b450588
MS
46}
47
48PRE.command EM, PRE.example EM {
49 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
50}
51
52P.command {
53 font-family: monaco, courier, monospace;
54 margin-left: 36pt;
55}
56
57P.formula {
58 font-style: italic;
59 margin-left: 36pt;
60}
61
62BLOCKQUOTE {
178cb736 63 background: #eeeeee;
8b450588
MS
64 border: solid thin #999999;
65 padding: 10pt;
66}
67
68A IMG {
69 border: none;
70}
71
72A:link:hover IMG {
73 background: #f0f0f0;
74 border-radius: 10px;
75 -moz-border-radius: 10px;
76}
77
78A:link, A:visited {
79 font-weight: normal;
80 text-decoration: none;
81}
82
83A:link:hover, A:visited:hover, A:active {
84 text-decoration: underline;
85}
86
87SUB, SUP {
88 font-size: 50%;
89}
90
91TR.data, TD.data, TR.data TD {
92 margin-top: 10pt;
93 padding: 5pt;
94 border-bottom: solid 1pt #999999;
95}
96
97TR.data TH {
98 border-bottom: solid 1pt #999999;
99 padding-top: 10pt;
100 padding-left: 5pt;
101 text-align: left;
102}
103
104DIV.table TABLE {
105 border: solid thin #999999;
106 border-collapse: collapse;
107 border-spacing: 0;
108 margin-left: auto;
109 margin-right: auto;
110}
111
112DIV.table CAPTION {
113 caption-side: top;
114 font-size: 120%;
115 font-style: italic;
116 font-weight: bold;
117 margin-left: auto;
118 margin-right: auto;
119}
120
121DIV.table TABLE TD {
122 border: solid thin #cccccc;
123 padding-top: 5pt;
124}
125
126DIV.table TABLE TH {
127 background: #cccccc;
128 border: none;
129 border-bottom: solid thin #999999;
130}
131
132DIV.figure TABLE {
133 margin-left: auto;
134 margin-right: auto;
135}
136
137DIV.figure CAPTION {
138 caption-side: bottom;
139 font-size: 120%;
140 font-style: italic;
141 font-weight: bold;
142 margin-left: auto;
143 margin-right: auto;
144}
145
146TH.label {
147 text-align: right;
148 vertical-align: top;
149}
150
151TH.sublabel {
152 text-align: right;
153 font-weight: normal;
154}
155
156HR {
157 border: solid thin;
158}
159
160SPAN.info {
161 background: black;
162 border: thin solid black;
163 color: white;
164 font-size: 80%;
165 font-style: italic;
166 font-weight: bold;
167 white-space: nowrap;
168}
169
170H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
171 float: right;
172 font-size: 100%;
173}
28b9d139 174
178cb736
MS
175H1.title {
176}
177
8b450588
MS
178H2.title, H3.title {
179 border-bottom: solid 2pt #000000;
180}
181
182DIV.indent, TABLE.indent {
183 margin-top: 2em;
184 margin-left: auto;
185 margin-right: auto;
186 width: 90%;
187}
188
189TABLE.indent {
190 border-collapse: collapse;
191}
192
193TABLE.indent TD, TABLE.indent TH {
194 padding: 0;
195}
196
197TABLE.list {
198 border-collapse: collapse;
199 margin-left: auto;
200 margin-right: auto;
201 width: 90%;
202}
203
204TABLE.list TH {
205 background: white;
206 border-bottom: solid thin #cccccc;
207 color: #444444;
208 padding-top: 10pt;
209 padding-left: 5pt;
210 text-align: left;
211 vertical-align: bottom;
212 white-space: nowrap;
213}
214
215TABLE.list TH A {
216 color: #4444cc;
217}
218
219TABLE.list TD {
220 border-bottom: solid thin #eeeeee;
221 padding-top: 5pt;
222 padding-left: 5pt;
223}
224
225TABLE.list TR:nth-child(even) {
226 background: #f8f8f8;
227}
228
229TABLE.list TR:nth-child(odd) {
230 background: #f4f4f4;
231}
232
233DT {
234 margin-left: 36pt;
235 margin-top: 12pt;
236}
237
238DD {
239 margin-left: 54pt;
240}
241
242DL.category DT {
243 font-weight: bold;
244}
245
246P.summary {
247 margin-left: 36pt;
248 font-family: monaco, courier, monospace;
249}
250
251DIV.summary TABLE {
252 border: solid thin #999999;
253 border-collapse: collapse;
254 border-spacing: 0;
255 margin: 10px;
256}
257
258DIV.summary TABLE TD, DIV.summary TABLE TH {
259 border: solid thin #999999;
260 padding: 5px;
261 text-align: left;
262 vertical-align: top;
263}
264
265DIV.summary TABLE THEAD TH {
266 background: #eeeeee;
267}
268
269/* API documentation styles... */
270div.body h1 {
271 margin: 0;
272}
273div.body h2 {
274 margin-top: 1.5em;
275}
276div.body h3, div.body h4, div.body h5 {
277 margin-bottom: 0.5em;
278 margin-top: 1.5em;
279}
280.class, .enumeration, .function, .struct, .typedef, .union {
281 border-bottom: solid thin #999999;
282 margin-bottom: 0;
283 margin-top: 2em;
284}
285.description {
286 margin-top: 0.5em;
287}
288code, p.code, pre, ul.code li {
289 font-family: monaco, courier, monospace;
290 font-size: 90%;
291}
292ul.code, ul.contents, ul.subcontents {
293 list-style-type: none;
294 margin: 0;
295 padding-left: 0;
296}
297ul.code li {
298 margin: 0;
299}
300ul.contents > li {
301 margin-top: 1em;
302}
303ul.contents li ul.code, ul.contents li ul.subcontents {
304 padding-left: 2em;
305}
306div.body dl {
307 margin-left: 0;
308 margin-top: 0;
309}
310div.body dt {
311 font-style: italic;
312 margin-left: 0;
313 margin-top: 0;
314}
315div.body dd {
316 margin-bottom: 0.5em;
317}
318
319/* This is just for the HTML files generated with the framedhelp target */
320div.contents {
321 background: #e8e8e8;
322 border: solid thin black;
323 padding: 10px;
324}
325div.contents h1 {
326 font-size: 110%;
327}
328div.contents h2 {
329 font-size: 100%;
330}
331div.contents ul.contents {
332 font-size: 80%;
333}
334div.contents ul.subcontents li {
335 margin-left: 1em;
336 text-indent: -1em;
337}
338--></style>
339</head>
340<body>
341<div class='body'>
10d09e33
MS
342<!--
343 "$Id$"
344
345 PPD compiler documentation for CUPS.
346
347 Copyright 2007-2010 by Apple Inc.
348 Copyright 1997-2007 by Easy Software Products.
349
350 These coded instructions, statements, and computer programs are the
351 property of Apple Inc. and are protected by Federal copyright
352 law. Distribution and use rights are outlined in the file "LICENSE.txt"
353 which should have been included with this file. If this file is
354 file is missing or damaged, see the license at "http://www.cups.org/".
355-->
356
178cb736
MS
357<h1 class='title'>Introduction to the PPD Compiler</h1>
358
28b9d139
MS
359<P>This document describes how to use the CUPS PostScript Printer Description
360(PPD) file compiler. The PPD compiler generates PPD files from simple text files
361that describe the features and capabilities of one or more printers.</P>
362
363<div class='summary'><table summary='General Information'>
364<tbody>
365<tr>
366 <th>See Also</th>
367 <td>Programming: <a href='raster-driver.html'>Developing Raster Printer Drivers</a><br>
368 Programming: <a href='postscript-driver.html'>Developing PostScript Printer Drivers</a><br>
369 Programming: <a href='api-filter.html'>Filter and Backend Programming</a><br>
370 Programming: <a href='api-raster.html'>Raster API</a><br>
371 References: <a href='ref-ppdcfile.html'>PPD Compiler Driver Information File Reference</a><br>
372 Specifications: <a href='spec-ppd.html'>CUPS PPD Extensions</a></td>
373</tr>
374</tbody>
375</table></div>
8b450588
MS
376<h2 class="title">Contents</h2>
377<ul class="contents">
426c6a59 378<ul class="subcontents">
8b450588
MS
379<li><a href="#BASICS">The Basics</a></li>
380<li><a href="#DRV">Driver Information Files</a><ul class="subcontents">
381<li><a href="#SIMPLE">A Simple Example</a></li>
382<li><a href="#GROUPING">Grouping and Inheritance</a></li>
383<li><a href="#COLOR">Color Support</a></li>
384<li><a href="#OPTIONS">Defining Custom Options and Option Groups</a></li>
385<li><a href="#DEFINE">Defining Constants</a></li>
386<li><a href="#CONDITIONAL">Conditional Statements</a></li>
387<li><a href="#CONSTRAINTS">Defining Constraints</a></li>
388</ul></li>
97c9a8d7
MS
389<li><a href="#LOCALIZATION">Localization</a><ul class="subcontents">
390<li><a href="#PPDPO">The ppdpo Utility</a></li>
391<li><a href="#PPDC_CATALOG">Using Message Catalogs with the PPD Compiler</a></li>
392</ul></li>
28b9d139
MS
393<h2 class='title'><a name='BASICS'>The Basics</a></h2>
394
395<P>The PPD compiler, <a href='man-ppdc.html'><code>ppdc(1)</code></a>, is a
396simple command-line tool that takes a single <I>driver information file</I>,
397which by convention uses the extension <VAR>.drv</VAR>, and produces one or more
398PPD files that may be distributed with your printer drivers for use with CUPS.
399For example, you would run the following command to create the English language
400PPD files defined by the driver information file <VAR>mydrivers.drv</VAR>:</P>
401
402<pre class='command'>
403ppdc mydrivers.drv
404</pre>
405
406<P>The PPD files are placed in a subdirectory called
407<VAR>ppd</VAR>. The <TT>-d</TT> option is used to put the PPD
408files in a different location, for example:</p>
409
410<pre class='command'>
411ppdc -d myppds mydrivers.drv
412</pre>
413
414<P>places the PPD files in a subdirectory named
415<VAR>myppds</VAR>. Finally, use the <TT>-l</TT> option to
416specify the language localization for the PPD files that are
417created, for example:</P>
418
419<pre class='command'>
420ppdc -d myppds/de -l de mydrivers.drv
421ppdc -d myppds/en -l en mydrivers.drv
422ppdc -d myppds/es -l es mydrivers.drv
423ppdc -d myppds/fr -l fr mydrivers.drv
424ppdc -d myppds/it -l it mydrivers.drv
425</pre>
426
427<P>creates PPD files in German (de), English (en), Spanish (es),
428French (fr), and Italian (it) in the corresponding
429subdirectories. Specify multiple languages (separated by commas) to produce
430"globalized" PPD files:</p>
431
432<pre class='command'>
433ppdc -d myppds -l de,en,es,fr,it mydrivers.drv
434</pre>
435
436
437<h2 class='title'><a name='DRV'>Driver Information Files</a></h2>
438
439<P>The driver information files accepted by the PPD compiler are
440plain text files that define the various attributes and options
441that are included in the PPD files that are generated. A driver
442information file can define the information for one or more printers and
443their corresponding PPD files.</P>
444
445<p class='example'><a name="LISTING1">Listing 1: "examples/minimum.drv"</a></p>
446
447<pre class='example'>
448<I>// Include standard font and media definitions</I>
449<a href='ref-ppdcfile.html#_include'>#include</a> &lt;font.defs&gt;
450<a href='ref-ppdcfile.html#_include'>#include</a> &lt;media.defs&gt;
451
452<I>// List the fonts that are supported, in this case all standard fonts...</I>
453<a href='ref-ppdcfile.html#Font'>Font</a> *
454
455<I>// Manufacturer, model name, and version</I>
456<a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "Foo"
457<a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
458<a href='ref-ppdcfile.html#Version'>Version</a> 1.0
459
460<I>// Each filter provided by the driver...</I>
461<a href='ref-ppdcfile.html#Filter'>Filter</a> application/vnd.cups-raster 100 rastertofoo
462
463<I>// Supported page sizes</I>
464*<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Letter
465<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> A4
466
467<I>// Supported resolutions</I>
468*<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "600dpi/600 DPI"
469
470<I>// Specify the name of the PPD file we want to generate...</I>
471<a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd"
472</pre>
473
474
475<h3><a name='SIMPLE'>A Simple Example</a></h3>
476
477<P>The example in <A HREF="#LISTING1">Listing 1</A> shows a driver information
478file which defines the minimum required attributes to provide a valid PPD file.
479The first part of the file includes standard definition files for fonts and
480media sizes:</P>
481
482<pre class='example'>
483<a href='ref-ppdcfile.html#_include'>#include</a> &lt;font.defs&gt;
484<a href='ref-ppdcfile.html#_include'>#include</a> &lt;media.defs&gt;
485</pre>
486
487<P>The <TT>#include</TT> directive works just like the C/C++ include directive;
488files included using the angle brackets (<TT>&lt;filename&gt;</TT>) are found
489in any of the standard include directories and files included using quotes
490(<TT>"filename"</TT>) are found in the same directory as the source or include
491file. The <TT>&lt;font.defs&gt;</TT> include file defines the standard fonts
492which are included with GPL Ghostscript and the Apple PDF RIP, while the
493<TT>&lt;media.defs&gt;</TT> include file defines the standard media sizes
494listed in Appendix B of the Adobe PostScript Printer Description File Format
495Specification.</P>
496
497<P>CUPS provides several other standard include files:</P>
498
499<UL>
500
501 <LI><TT>&lt;epson.h&gt;</TT> - Defines all of the rastertoepson driver
502 constants.</LI>
503
504 <LI><TT>&lt;escp.h&gt;</TT> - Defines all of the rastertoescpx driver
505 constants.</LI>
506
507 <LI><TT>&lt;hp.h&gt;</TT> - Defines all of the rastertohp driver
508 constants.</LI>
509
510 <LI><TT>&lt;label.h&gt;</TT> - Defines all of the rastertolabel driver
511 constants.</LI>
512
513 <LI><TT>&lt;pcl.h&gt;</TT> - Defines all of the rastertopclx driver
514 constants.</LI>
515
516 <LI><TT>&lt;raster.defs&gt;</TT> - Defines all of the CUPS raster format
517 constants.</LI>
518
519</UL>
520
521<P>Next we list all of the fonts that are available in the driver; for CUPS
522raster drivers, the following line is all that is usually supplied:</P>
523
524<pre class='example'>
525<a href='ref-ppdcfile.html#Font'>Font</a> *
526</pre>
527
528<P>The <TT>Font</TT> directive specifies the name of a single font or the
529asterisk to specify all fonts. For example, you would use the following line to
530define an additional bar code font that you are supplying with your printer
531driver:</P>
532
533<pre class='example'>
534<I>// name encoding version charset status</I>
535<a href='ref-ppdcfile.html#Font'>Font</a> Barcode-Foo Special "(1.0)" Special ROM
536</pre>
537
538<P>The name of the font is <TT>Barcode-Foo</TT>. Since it is not a standard
539text font, the encoding and charset name <TT>Special</TT> is used. The version
540number is <TT>1.0</TT> and the status (where the font is located) is
541<TT>ROM</TT> to indicate that the font does not need to be embedded in
542documents that use the font for this printer.</P>
543
544<P>Third comes the manufacturer, model name, and version number information
545strings:</P>
546
547<pre class='example'>
548<a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "Foo"
549<a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
550<a href='ref-ppdcfile.html#Version'>Version</a> 1.0
551</pre>
552
553<P>These strings are used when the user (or auto-configuration program) selects
554the printer driver for a newly connected device.</p>
555
556<P>The list of filters comes after the information strings; for the example in
557<A HREF="#LISTING1">Listing 1</A>, we have a single filter that takes CUPS
558raster data:</P>
559
560<pre class='example'>
561<a href='ref-ppdcfile.html#Filter'>Filter</a> application/vnd.cups-raster 100 rastertofoo
562</pre>
563
564<P>Each filter specified in the driver information file is the equivalent of a
565printer driver for that format; if a user submits a print job in a different
566format, CUPS figures out the sequence of commands that will produce a supported
567format for the least relative cost.</P>
568
569<P>Once we have defined the driver information we specify the supported options.
570For the example driver we support a single resolution of 600 dots per inch and
571two media sizes, A4 and Letter:</P>
572
573<pre class='example'>
574*<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Letter
575<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> A4
576
577*<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "600dpi/600 DPI"
578</pre>
579
580<P>The asterisk in front of the <TT>MediaSize</TT> and <TT>Resolution</TT>
581directives specify that those option choices are the default. The
582<TT>MediaSize</TT> directive is followed by a media size name which is normally
583defined in the <TT>&lt;media.defs&gt;</TT> file and corresponds to a standard
584Adobe media size name. If the default media size is <TT>Letter</TT>, the PPD
585compiler will override it to be <TT>A4</TT> for non-English localizations for
586you automatically.</P>
587
588<P>The <TT>Resolution</TT> directive accepts several values after it as
589follows:</P>
590
591<OL>
592
593 <LI>Colorspace for this resolution, if any. In the example file, the
594 colorspace <TT>k</TT> is used which corresponds to black. For printer
595 drivers that support color printing, this field is usually specified as
596 "-" for "no change".</LI>
597
598 <LI>Bits per color. In the example file, we define 8 bits per color, for
599 a continuous-tone grayscale output. All versions of CUPS support 1 and
600 8 bits per color. CUPS 1.2 and higher (Mac OS X 10.5 and higher) also
601 supports 16 bits per color.</LI>
602
603 <LI>Rows per band. In the example file, we define 0 rows per band to
604 indicate that our printer driver does not process the page in
605 bands.</LI>
606
607 <LI>Row feed. In the example, we define the feed value to be 0 to
608 indicate that our printer driver does not interleave the output.</LI>
609
610 <LI>Row step. In the example, we define the step value to be 0 to
611 indicate that our printer driver does not interleave the output. This
612 value normally indicates the spacing between the nozzles of an inkjet
613 printer - when combined with the previous two values, it informs the
614 driver how to stagger the output on the page to produce interleaved
615 lines on the page for higher-resolution output.</LI>
616
617 <LI>Choice name and text. In the example, we define the choice name and
618 text to be <TT>"600dpi/600 DPI"</TT>. The name and text are separated by
619 slash (<TT>/</TT>) character; if no text is specified, then the name is
620 used as the text. The PPD compiler parses the name to determine the
621 actual resolution; the name can be of the form
622 <TT><I>RESOLUTION</I>dpi</TT> for resolutions that are equal
623 horizontally and vertically or <TT><I>HRES</I>x<I>VRES</I>dpi</TT> for
624 isometric resolutions. Only integer resolution values are supported, so
625 a resolution name of <TT>300dpi</TT> is valid while <TT>300.1dpi</TT> is
626 not.</LI>
627
628</OL>
629
630<P>Finally, the <TT>PCFileName</TT> directive specifies that the named PPD file
631should be written for the current driver definitions:</P>
632
633<pre class='example'>
634<a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd"
635</pre>
636
637<P>The filename follows the directive and <I>must</I> conform to the Adobe
638filename requirements in the Adobe Postscript Printer Description File Format
639Specification. Specifically, the filename may not exceed 8 characters followed
640by the extension <VAR>.ppd</VAR>. The <TT>FileName</TT> directive can be used to
641specify longer filenames:</P>
642
643<pre class='example'>
644<a href='ref-ppdcfile.html#FileName'>FileName</a> "FooJet 2000"
645</pre>
646
647
648<h3><a name='GROUPING'>Grouping and Inheritance</a></h3>
649
650<P>The previous example created a single PPD file. Driver information files can
651also define multiple printers by using the PPD compiler grouping functionality.
652Directives are grouped using the curly braces (<TT>{</TT> and <TT>}</TT>) and
653every group that uses the <TT>PCFileName</TT> or <TT>FileName</TT> directives
654produces a PPD file with that name. <A HREF="#LISTING2">Listing 2</A> shows a
655variation of the original example that uses two groups to define two printers
656that share the same printer driver filter but provide two different resolution
657options.</P>
658
659<p class='example'><a name="LISTING2">Listing 2: "examples/grouping.drv"</a></p>
660
661<pre class='example'>
662
663<I>// Include standard font and media definitions</I>
664<a href='ref-ppdcfile.html#_include'>#include</a> &lt;font.defs&gt;
665<a href='ref-ppdcfile.html#_include'>#include</a> &lt;media.defs&gt;
666
667<I>// List the fonts that are supported, in this case all standard fonts...</I>
668<a href='ref-ppdcfile.html#Font'>Font</a> *
669
670<I>// Manufacturer and version</I>
671<a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "Foo"
672<a href='ref-ppdcfile.html#Version'>Version</a> 1.0
673
674<I>// Each filter provided by the driver...</I>
675<a href='ref-ppdcfile.html#Filter'>Filter</a> application/vnd.cups-raster 100 rastertofoo
676
677<I>// Supported page sizes</I>
678*<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Letter
679<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> A4
680
681{
682 <I>// Supported resolutions</I>
683 *<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "600dpi/600 DPI"
684
685 <I>// Specify the model name and filename...</I>
686 <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
687 <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd"
688}
689
690{
691 <I>// Supported resolutions</I>
692 *<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "1200dpi/1200 DPI"
693
694 <I>// Specify the model name and filename...</I>
695 <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2001"
696 <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojt2k1.ppd"
697}
698</pre>
699
700<P>The second example is essentially the same as the first, except that each
701printer model is defined inside of a pair of curly braces. For example, the
702first printer is defined using:</P>
703
704<pre class='example'>
705{
706 // Supported resolutions
707 *<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "600dpi/600 DPI"
708
709 // Specify the model name and filename...
710 <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
711 <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd"
712}
713</pre>
714
715<P>The printer <I>inherits</I> all of the definitions from the parent group (the
716top part of the file) and adds the additional definitions inside the curly
717braces for that printer driver. When we define the second group, it also
718inherits the same definitions from the parent group but <I>none</I> of the
719definitions from the first driver. Groups can be nested to any number of levels
720to support variations of similar models without duplication of information.</P>
721
722
723<h3><a name='COLOR'>Color Support</a></h3>
724
725<P>For printer drivers that support color printing, the
726<TT>ColorDevice</TT> and <TT>ColorModel</TT> directives should be
727used to tell the printing system that color output is desired
728and in what formats. <A HREF="#LISTING3">Listing 3</A> shows a
729variation of the previous example which includes a color printer
730that supports printing at 300 and 600 DPI.</P>
731
732<P>The key changes are the addition of the <TT>ColorDevice</TT>
733directive:</P>
734
735<pre class='example'>
736<a href='ref-ppdcfile.html#ColorDevice'>ColorDevice</a> true
737</pre>
738
739<P>which tells the printing system that the printer supports
740color printing, and the <TT>ColorModel</TT> directives:</P>
741
742<pre class='example'>
743<a href='ref-ppdcfile.html#ColorModel'>ColorModel</a> Gray/Grayscale w chunky 0
744*<a href='ref-ppdcfile.html#ColorModel'>ColorModel</a> RGB/Color rgb chunky 0
745</pre>
746
747<P>which tell the printing system which colorspaces are supported by the printer
748driver for color printing. Each of the <TT>ColorModel</TT> directives is
749followed by the option name and text (<TT>Gray/Grayscale</TT> and
750<TT>RGB/Color</TT>), the colorspace name (<TT>w</TT> and <TT>rgb</TT>), the
751color organization (<TT>chunky</TT>), and the compression mode number
752(<TT>0</TT>) to be passed to the driver. The option name can be any of the
753standard Adobe <TT>ColorModel</TT> names:</P>
754
755<UL>
756
757 <LI><TT>Gray</TT> - Grayscale output.
758
759 <LI><TT>RGB</TT> - Color output, typically using the RGB
760 colorspace, but without a separate black channel.
761
762 <LI><TT>CMYK</TT> - Color output with a separate black
763 channel.
764
765</UL>
766
767<P>Custom names can be used, however it is recommended that you use your vendor
768prefix for any custom names, for example "fooName".</P>
769
770<P>The colorspace name can be any of the following universally supported
771colorspaces:</P>
772
773<UL>
774 <LI><TT>w</TT> - Luminance</LI>
775
776 <LI><TT>rgb</TT> - Red, green, blue</LI>
777
778 <LI><TT>k</TT> - Black</LI>
779
780 <LI><TT>cmy</TT> - Cyan, magenta, yellow</LI>
781
782 <LI><TT>cmyk</TT> - Cyan, magenta, yellow, black</LI>
783
784</UL>
785
786<P>The color organization can be any of the following values:</P>
787
788<UL>
789
790 <LI><TT>chunky</TT> - Color values are passed together on a line
791 as RGB RGB RGB RGB</LI>
792
793 <LI><TT>banded</TT> - Color values are passed separately
794 on a line as RRRR GGGG BBBB; not supported by the Apple
795 RIP filters</LI>
796
797 <LI><TT>planar</TT> - Color values are passed separately
798 on a page as RRRR RRRR RRRR ... GGGG GGGG GGGG ... BBBB
799 BBBB BBBB; not supported by the Apple RIP filters</LI>
800
801</UL>
802
803<P>The compression mode value is passed to the driver in the
804<TT>cupsCompression</TT> attribute. It is traditionally used to select an
805appropriate compression mode for the color model but can be used for any
806purpose, such as specifying a photo mode vs. standard mode.</P>
807
808<p class='example'><a name="LISTING3">Listing 3: "examples/color.drv"</a></p>
809
810<pre class='example'>
811
812<I>// Include standard font and media definitions</I>
813<a href='ref-ppdcfile.html#_include'>#include</a> &lt;font.defs&gt;
814<a href='ref-ppdcfile.html#_include'>#include</a> &lt;media.defs&gt;
815
816<I>// List the fonts that are supported, in this case all standard fonts...</I>
817<a href='ref-ppdcfile.html#Font'>Font</a> *
818
819<I>// Manufacturer and version</I>
820<a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "Foo"
821<a href='ref-ppdcfile.html#Version'>Version</a> 1.0
822
823<I>// Each filter provided by the driver...</I>
824<a href='ref-ppdcfile.html#Filter'>Filter</a> application/vnd.cups-raster 100 rastertofoo
825
826<I>// Supported page sizes</I>
827*<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Letter
828<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> A4
829
830{
831 <I>// Supported resolutions</I>
832 *<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "600dpi/600 DPI"
833
834 <I>// Specify the model name and filename...</I>
835 <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
836 <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd"
837}
838
839{
840 <I>// Supports color printing</I>
841 <a href='ref-ppdcfile.html#ColorDevice'>ColorDevice</a> true
842
843 <I>// Supported colorspaces</I>
844 <a href='ref-ppdcfile.html#ColorModel'>ColorModel</a> Gray/Grayscale w chunky 0
845 *<a href='ref-ppdcfile.html#ColorModel'>ColorModel</a> RGB/Color rgb chunky 0
846
847 <I>// Supported resolutions</I>
848 *<a href='ref-ppdcfile.html#Resolution'>Resolution</a> - 8 0 0 0 "300dpi/300 DPI"
849 <a href='ref-ppdcfile.html#Resolution'>Resolution</a> - 8 0 0 0 "600dpi/600 DPI"
850
851 <I>// Specify the model name and filename...</I>
852 <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet Color"
853 <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojetco.ppd"
854}
855</pre>
856
857
858<h3><a name='OPTIONS'>Defining Custom Options and Option Groups</a></h3>
859
860<P>The <TT>Group</TT>, <TT>Option</TT>, and <TT>Choice</TT>
861directives are used to define or select a group, option, or
862choice. <A HREF="#LISTING4">Listing 4</A> shows a variation of
863the first example that provides two custom options in a group
864named "Footasm".</P>
865
866<p class='example'><a name="LISTING4">Listing 4: "examples/custom.drv"</a></p>
867
868<pre class='example'>
869
870<I>// Include standard font and media definitions</I>
871<a href='ref-ppdcfile.html#_include'>#include</a> &lt;font.defs&gt;
872<a href='ref-ppdcfile.html#_include'>#include</a> &lt;media.defs&gt;
873
874<I>// List the fonts that are supported, in this case all standard fonts...</I>
875<a href='ref-ppdcfile.html#Font'>Font</a> *
876
877<I>// Manufacturer, model name, and version</I>
878<a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "Foo"
879<a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
880<a href='ref-ppdcfile.html#Version'>Version</a> 1.0
881
882<I>// Each filter provided by the driver...</I>
883<a href='ref-ppdcfile.html#Filter'>Filter</a> application/vnd.cups-raster 100 rastertofoo
884
885<I>// Supported page sizes</I>
886*<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Letter
887<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> A4
888
889<I>// Supported resolutions</I>
890*<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "600dpi/600 DPI"
891
892<I>// Option Group</I>
893<a href='ref-ppdcfile.html#Group'>Group</a> "Footasm"
894
895 <I>// Boolean option</I>
896 <a href='ref-ppdcfile.html#Option'>Option</a> "fooEnhance/Resolution Enhancement" Boolean AnySetup 10
897 *<a href='ref-ppdcfile.html#Choice'>Choice</a> True/Yes "&lt;&lt;/cupsCompression 1&gt;&gt;setpagedevice"
898 <a href='ref-ppdcfile.html#Choice'>Choice</a> False/No "&lt;&lt;/cupsCompression 0&gt;&gt;setpagedevice"
899
900 <I>// Multiple choice option</I>
901 <a href='ref-ppdcfile.html#Option'>Option</a> "fooOutputType/Output Quality" PickOne AnySetup 10
902 *<a href='ref-ppdcfile.html#Choice'>Choice</a> "Auto/Automatic Selection"
903 "&lt;&lt;/OutputType(Auto)&gt;&gt;setpagedevice""
904 <a href='ref-ppdcfile.html#Choice'>Choice</a> "Text/Optimize for Text"
905 "&lt;&lt;/OutputType(Text)&gt;&gt;setpagedevice""
906 <a href='ref-ppdcfile.html#Choice'>Choice</a> "Graph/Optimize for Graphics"
907 "&lt;&lt;/OutputType(Graph)&gt;&gt;setpagedevice""
908 <a href='ref-ppdcfile.html#Choice'>Choice</a> "Photo/Optimize for Photos"
909 "&lt;&lt;/OutputType(Photo)&gt;&gt;setpagedevice""
910
911<I>// Specify the name of the PPD file we want to generate...</I>
912<a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd"
913</pre>
914
915<P>The custom group is introduced by the <TT>Group</TT>
916directive which is followed by the name and optionally text for
917the user:</P>
918
919<pre class='example'>
920<a href='ref-ppdcfile.html#Group'>Group</a> "Footasm/Footastic Options"
921</pre>
922
923<P>The group name must conform to the PPD specification and
924cannot exceed 40 characters in length. If you specify user text,
925it cannot exceed 80 characters in length. The groups
926<TT>General</TT>, <TT>Extra</TT>, and
927<TT>InstallableOptions</TT> are predefined by CUPS; the general
928and extra groups are filled by the UI options defined by the PPD
929specification. The <TT>InstallableOptions</TT> group is reserved
930for options that define whether accessories for the printer
931(duplexer unit, finisher, stapler, etc.) are installed.</P>
932
933<P>Once the group is specified, the <TT>Option</TT> directive is
934used to introduce a new option:</P>
935
936<pre class='example'>
937<a href='ref-ppdcfile.html#Option'>Option</a> "fooEnhance/Resolution Enhancement" Boolean AnySetup 10
938</pre>
939
940<P>The directive is followed by the name of the option and any
941optional user text, the option type, the PostScript document group, and
942the sort order number. The option name must conform to the PPD specification
943and cannot exceed 40 characters in length. If you specify user text, it
944cannot exceed 80 characters in length.</P>
945
946<P>The option type can be <TT>Boolean</TT> for true/false
947selections, <TT>PickOne</TT> for picking one of many choices, or
948<TT>PickMany</TT> for picking zero or more choices. Boolean
949options can have at most two choices with the names
950<TT>False</TT> and <TT>True</TT>. Pick options can have any
951number of choices, although for Windows compatibility reasons
952the number of choices should not exceed 255.</P>
953
954<P>The PostScript document group is typically <TT>AnySetup</TT>,
955meaning that the option can be introduced at any point in the
956PostScript document. Other values include <TT>PageSetup</TT> to
957include the option before each page and <TT>DocumentSetup</TT>
958to include the option once at the beginning of the document.</P>
959
960<P>The sort order number is used to sort the printer commands
961associated with each option choice within the PostScript
962document. This allows you to setup certain options before others
963as required by the printer. For most CUPS raster printer
964drivers, the value <TT>10</TT> can be used for all options.</P>
965
966<P>Once the option is specified, each option choice can be
967listed using the <TT>Choice</TT> directive:</P>
968
969<pre class='example'>
970*<a href='ref-ppdcfile.html#Choice'>Choice</a> True/Yes "&lt;&lt;/cupsCompression 1&gt;&gt;setpagedevice"
971<a href='ref-ppdcfile.html#Choice'>Choice</a> False/No "&lt;&lt;/cupsCompression 0&gt;&gt;setpagedevice"
972</pre>
973
974<P>The directive is followed by the choice name and optionally
975user text, and the PostScript commands that should be inserted
976when printing a file to this printer. The option name must
977conform to the PPD specification and cannot exceed 40 characters
978in length. If you specify user text, it cannot exceed 80
979characters in length.</P>
980
981<P>The PostScript commands are also interpreted by any RIP
982filters, so these commands typically must be present for all
983option choices. Most commands take the form:</P>
984
985<pre class='example'>
986&lt;&lt;/name value&gt;&gt;setpagedevice
987</pre>
988
989<P>where <TT>name</TT> is the name of the PostScript page device
990attribute and <TT>value</TT> is the numeric or string value for
991that attribute.</P>
992
993
994<h3><a name='DEFINE'>Defining Constants</a></h3>
995
996<P>Sometimes you will want to define constants for your drivers
997so that you can share values in different groups within the same
998driver information file, or to share values between different
999driver information files using the <TT>#include</TT> directive.
1000The <TT>#define</TT> directive is used to define constants for
1001use in your printer definitions:</P>
1002
1003<pre class='example'>
1004<a href='ref-ppdcfile.html#_define'>#define</a> NAME value
1005</pre>
1006
1007<P>The <TT>NAME</TT> is any sequence of letters, numbers, and
1008the underscore. The <TT>value</TT> is a number or string; if the
1009value contains spaces you must put double quotes around it, for
1010example:</P>
1011
1012<pre class='example'>
1013<a href='ref-ppdcfile.html#_define'>#define</a> FOO "My String Value"
1014</pre>
1015
1016<P>Constants can also be defined on the command-line using the <tt>-D</tt>
1017option:</P>
1018
1019<pre class='command'>
1020ppdc -DNAME="value" filename.drv
1021</pre>
1022
1023<P>Once defined, you use the notation <TT>$NAME</TT> to substitute the value of
1024the constant in the file, for example:</P>
1025
1026<pre class='example'>
1027<a href='ref-ppdcfile.html#_define'>#define</a> MANUFACTURER "Foo"
1028<a href='ref-ppdcfile.html#_define'>#define</a> FOO_600 0
1029<a href='ref-ppdcfile.html#_define'>#define</a> FOO_1200 1
1030
1031{
1032 <a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "$MANUFACTURER"
1033 <a href='ref-ppdcfile.html#ModelNumber'>ModelNumber</a> $FOO_600
1034 <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
1035 ...
1036}
1037
1038{
1039 <a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "$MANUFACTURER"
1040 <a href='ref-ppdcfile.html#ModelNumber'>ModelNumber</a> $FOO_1200
1041 <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2001"
1042 ...
1043}
1044</pre>
1045
1046<P>Numeric constants can be bitwise OR'd together by placing the constants
1047inside parenthesis, for example:</P>
1048
1049<pre class='example'>
1050<I>// ModelNumber capability bits</I>
1051<a href='ref-ppdcfile.html#_define'>#define</a> DUPLEX 1
1052<a href='ref-ppdcfile.html#_define'>#define</a> COLOR 2
1053
1054...
1055
1056{
1057 <I>// Define a model number specifying the capabilities of the printer...</I>
1058 <a href='ref-ppdcfile.html#ModelNumber'>ModelNumber</a> ($DUPLEX $COLOR)
1059 ...
1060}
1061</pre>
1062
1063
1064<h3><a name='CONDITIONAL'>Conditional Statements</a></h3>
1065
1066<p>The PPD compiler supports conditional compilation using the <tt>#if</tt>,
1067<tt>#elif</tt>, <tt>#else</tt>, and <tt>#endif</tt> directives. The <tt>#if</tt>
1068and <tt>#elif</tt> directives are followed by a constant name or an expression.
1069For example, to include a group of options when "ADVANCED" is defined:</p>
1070
1071<pre class='example'>
1072<a href='ref-ppdcfile.html#_if'>#if</a> ADVANCED
1073<a href='ref-ppdcfile.html#Group'>Group</a> "Advanced/Advanced Options"
1074 <a href='ref-ppdcfile.html#Option'>Option</a> "fooCyanAdjust/Cyan Adjustment"
1075 <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus10/+10%" ""
1076 <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus5/+5%" ""
1077 *<a href='ref-ppdcfile.html#Choice'>Choice</a> "none/No Adjustment" ""
1078 <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus5/-5%" ""
1079 <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus10/-10%" ""
1080 <a href='ref-ppdcfile.html#Option'>Option</a> "fooMagentaAdjust/Magenta Adjustment"
1081 <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus10/+10%" ""
1082 <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus5/+5%" ""
1083 *<a href='ref-ppdcfile.html#Choice'>Choice</a> "none/No Adjustment" ""
1084 <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus5/-5%" ""
1085 <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus10/-10%" ""
1086 <a href='ref-ppdcfile.html#Option'>Option</a> "fooYellowAdjust/Yellow Adjustment"
1087 <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus10/+10%" ""
1088 <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus5/+5%" ""
1089 *<a href='ref-ppdcfile.html#Choice'>Choice</a> "none/No Adjustment" ""
1090 <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus5/-5%" ""
1091 <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus10/-10%" ""
1092 <a href='ref-ppdcfile.html#Option'>Option</a> "fooBlackAdjust/Black Adjustment"
1093 <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus10/+10%" ""
1094 <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus5/+5%" ""
1095 *<a href='ref-ppdcfile.html#Choice'>Choice</a> "none/No Adjustment" ""
1096 <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus5/-5%" ""
1097 <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus10/-10%" ""
1098<a href='ref-ppdcfile.html#_endif'>#endif</a>
1099</pre>
1100
1101
1102<h3><a name='CONSTRAINTS'>Defining Constraints</a></h3>
1103
1104<P>Constraints are strings that are used to specify that one or more option
1105choices are incompatible, for example two-sided printing on transparency media.
1106Constraints are also used to prevent the use of uninstalled features such as the
1107duplexer unit, additional media trays, and so forth.</P>
1108
1109<P>The <TT>UIConstraints</TT> directive is used to specify a constraint that is
1110placed in the PPD file. The directive is followed by a string using one of the
1111following formats:</P>
1112
1113<pre class='example'>
1114<a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Option1 *Option2"
1115<a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Option1 Choice1 *Option2"
1116<a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Option1 *Option2 Choice2"
1117<a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Option1 Choice1 *Option2 Choice2"
1118</pre>
1119
1120<P>Each option name is preceded by the asterisk (<TT>*</TT>). If no choice is
1121given for an option, then all choices <I>except</I> <TT>False</TT> and
1122<TT>None</TT> will conflict with the other option and choice(s). Since the PPD
1123compiler automatically adds reciprocal constraints (option A conflicts with
1124option B, so therefore option B conflicts with option A), you need only specify
1125the constraint once.</P>
1126
1127<p class='example'><a name="LISTING5">Listing 5: "examples/constraint.drv"</a></p>
1128
1129<pre class='example'>
1130
1131<I>// Include standard font and media definitions</I>
1132<a href='ref-ppdcfile.html#_include'>#include</a> &lt;font.defs&gt;
1133<a href='ref-ppdcfile.html#_include'>#include</a> &lt;media.defs&gt;
1134
1135<I>// List the fonts that are supported, in this case all standard fonts...</I>
1136<a href='ref-ppdcfile.html#Font'>Font</a> *
1137
1138<I>// Manufacturer, model name, and version</I>
1139<a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "Foo"
1140<a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
1141<a href='ref-ppdcfile.html#Version'>Version</a> 1.0
1142
1143<I>// Each filter provided by the driver...</I>
1144<a href='ref-ppdcfile.html#Filter'>Filter</a> application/vnd.cups-raster 100 rastertofoo
1145
1146<I>// Supported page sizes</I>
1147*<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Letter
1148<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> A4
1149
1150<I>// Supported resolutions</I>
1151*<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "600dpi/600 DPI"
1152
1153<I>// Installable Option Group</I>
1154<a href='ref-ppdcfile.html#Group'>Group</a> "InstallableOptions/Options Installed"
1155
1156 <I>// Duplexing unit option</I>
1157 <a href='ref-ppdcfile.html#Option'>Option</a> "OptionDuplexer/Duplexing Unit" Boolean AnySetup 10
1158 <a href='ref-ppdcfile.html#Choice'>Choice</a> True/Installed ""
1159 *<a href='ref-ppdcfile.html#Choice'>Choice</a> "False/Not Installed" ""
1160
1161<I>// General Option Group</I>
1162<a href='ref-ppdcfile.html#Group'>Group</a> General
1163
1164 <I>// Duplexing option</I>
1165 <a href='ref-ppdcfile.html#Option'>Option</a> "Duplex/Two-Sided Printing" PickOne AnySetup 10
1166 *<a href='ref-ppdcfile.html#Choice'>Choice</a> "None/No" "&lt;&lt;/Duplex false&gt;&gt;setpagedevice""
1167 <a href='ref-ppdcfile.html#Choice'>Choice</a> "DuplexNoTumble/Long Edge Binding"
1168 "&lt;&lt;/Duplex true/Tumble false&gt;&gt;setpagedevice""
1169 <a href='ref-ppdcfile.html#Choice'>Choice</a> "DuplexTumble/Short Edge Binding"
1170 "&lt;&lt;/Duplex true/Tumble true&gt;&gt;setpagedevice""
1171
1172<I>// Only allow duplexing if the duplexer is installed</I>
1173<a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Duplex *OptionDuplexer False"
1174
1175<I>// Specify the name of the PPD file we want to generate...</I>
1176<a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd"
1177</pre>
1178
1179<P><A HREF="#LISTING5">Listing 5</A> shows a variation of the first example with
1180an added <TT>Duplex</TT> option and installable option for the duplexer,
1181<TT>OptionDuplex</TT>. A constraint is added at the end to specify that any
1182choice of the <TT>Duplex</TT> option that is not <TT>None</TT> is incompatible
1183with the "Duplexer Installed" option set to "Not Installed"
1184(<TT>False</TT>):</P>
1185
1186<pre class='example'>
1187<a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Duplex *OptionDuplexer False"
1188</pre>
1189
1190<h4>Enhanced Constraints</h4>
1191
1192<p>CUPS 1.4 supports constraints between 2 or more options using the
1193<TT>Attribute</TT> directive. <TT>cupsUIConstraints</TT> attributes define
1194the constraints, while <TT>cupsUIResolver</TT> attributes define option changes
1195to resolve constraints. For example, we can specify the previous duplex
1196constraint with a resolver that turns off duplexing with the following two
1197lines:</p>
1198
1199<pre class='example'>
1200<a href='ref-ppdcfile.html#Attribute'>Attribute</a> cupsUIConstraints DuplexOff "*Duplex *OptionDuplexer False"
1201<a href='ref-ppdcfile.html#Attribute'>Attribute</a> cupsUIResolver DuplexOff "*Duplex None"
1202</pre>
97c9a8d7
MS
1203
1204<h2 class='title'><a name='LOCALIZATION'>Localization</a></h2>
1205
1206<p>The PPD compiler provides localization of PPD files in different languages
1207through <i>message catalog</i> files in the GNU gettext or Apple .strings
1208formats. Each user text string and several key PPD attribute values such as
1209<tt>LanguageVersion</tt> and <tt>LanguageEncoding</tt> are looked up in the
1210corresponding message catalog and the translated text is substituted in the
1211generated PPD files. One message catalog file can be used by multiple driver
1212information files, and each file contains a single language translation.</p>
1213
1214<h3><a name='PPDPO'>The ppdpo Utility</a></h3>
1215
1216<p>While CUPS includes localizations of all standard media sizes and options in
1217several languages, your driver information files may provide their own media
1218sizes and options that need to be localized. CUPS provides a utility program to
1219aid in the localization of drivers called <a
1220href='man-ppdpo.html'><tt>ppdpo(1)</tt></a>. The <tt>ppdpo</tt> program creates
1221or updates a message catalog file based upon one or more driver information
1222files. New messages are added with the word "TRANSLATE" added to the front of
1223the translation string to make locating new strings for translation easier. The
1224program accepts the message catalog filename and one or more driver information
1225files.</p>
1226
1227<p>For example, run the following command to create a new German message catalog
1228called <var>de.po</var> for all of the driver information files in the current
1229directory:</p>
1230
1231<pre class='command'>
1232ppdpo -o de.po *.drv
1233</pre>
1234
1235<p>If the file <var>de.po</var> already exists, <tt>ppdpo</tt> will update the
1236contents of the file with any new messages that need to be translated. To create
1237an Apple .strings file instead, specify the output filename with a .strings
1238extension, for example:</p>
1239
1240<pre class='command'>
1241ppdpo -o de.strings *.drv
1242</pre>
1243
1244<h3><a name='PPDC_CATALOG'>Using Message Catalogs with the PPD Compiler</a></h3>
1245
1246<p>Once you have created a message catalog, use the <a
1247href='ref-ppdcfile.html#_po'><tt>#po</tt></a> directive to declare it in each
1248driver information file. For example, to declare the German message catalog for
1249a driver use:</p>
1250
1251<pre class='example'>
1252<a href='ref-ppdcfile.html#_po'>#po</a> de "de.po" // German
1253</pre>
1254
1255<p>In fact, you can use the <tt>#po</tt> directive as many times as needed:</p>
1256
1257<pre class='example'>
1258<a href='ref-ppdcfile.html#_po'>#po</a> de "de.po" // German
1259<a href='ref-ppdcfile.html#_po'>#po</a> es "es.po" // Spanish
1260<a href='ref-ppdcfile.html#_po'>#po</a> fr "fr.po" // French
1261<a href='ref-ppdcfile.html#_po'>#po</a> it "it.po" // Italian
1262<a href='ref-ppdcfile.html#_po'>#po</a> ja "ja.po" // Japanese
1263</pre>
1264
1265<p>The filename ("de.po", etc.) can be relative to the location of the driver
1266information file or an absolute path. Once defined, the PPD compiler will
1267automatically generate a globalized PPD for every language declared in your
1268driver information file. To generate a single-language PPD file, simply use the
1269<tt>-l</tt> option to list the corresponding locale, for example:</p>
1270
1271<pre class='command'>
1272ppdc -l de -d ppd/de mydrivers.drv
1273</pre>
1274
1275<p>to generate German PPD files.</p>
8b450588
MS
1276</div>
1277</body>
1278</html>