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