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