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