This file is indexed.

/usr/share/cups/doc-root/help/ppd-compiler.html is in cups-server-common 1.7.2-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- SECTION: Programming -->
<head>
	<title>Introduction to the PPD Compiler	</title>
	<meta name="keywords" content="Programming">
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
	<meta name="creator" content="Mini-XML v2.7">
<style type="text/css"><!--
BODY {
  font-family: lucida grande, geneva, helvetica, arial, sans-serif;
}

H1, H2, H3, H4, H5, H6, P, TD, TH {
  font-family: lucida grande, geneva, helvetica, arial, sans-serif;
}

KBD {
  font-family: monaco, courier, monospace;
  font-weight: bold;
}

PRE {
  font-family: monaco, courier, monospace;
}

PRE.command {
  border: dotted thin #7f7f7f;
  margin-left: 36pt;
  padding: 10px;
}

P.compact {
  margin: 0;
}

P.example {
  font-style: italic;
  margin-left: 36pt;
}
  
PRE.example {
  background: #eeeeee;
  border: dotted thin #999999;
  margin-left: 36pt;
  padding: 10pt;
}

PRE.command EM, PRE.example EM {
  font-family: lucida grande, geneva, helvetica, arial, sans-serif;
}

P.command {
  font-family: monaco, courier, monospace;
  margin-left: 36pt;
}

P.formula {
  font-style: italic;
  margin-left: 36pt;
}

BLOCKQUOTE {
  background: #eeeeee;
  border: solid thin #999999;
  padding: 10pt;
}

A IMG {
  border: none;
}

A:link:hover IMG {
  background: #f0f0f0;
  border-radius: 10px;
  -moz-border-radius: 10px;
}

A:link, A:visited {
  font-weight: normal;
  text-decoration: none;
}

A:link:hover, A:visited:hover, A:active {
  text-decoration: underline;
}

SUB, SUP {
  font-size: 50%;
}

TR.data, TD.data, TR.data TD {
  margin-top: 10pt;
  padding: 5pt;
  border-bottom: solid 1pt #999999;
}

TR.data TH {
  border-bottom: solid 1pt #999999;
  padding-top: 10pt;
  padding-left: 5pt;
  text-align: left;
}

DIV.table TABLE {
  border: solid thin #999999;
  border-collapse: collapse;
  border-spacing: 0;
  margin-left: auto;
  margin-right: auto;
}

DIV.table CAPTION {
  caption-side: top;
  font-size: 120%;
  font-style: italic;
  font-weight: bold;
  margin-left: auto;
  margin-right: auto;
}

DIV.table TABLE TD {
  border: solid thin #cccccc;
  padding-top: 5pt;
}

DIV.table TABLE TH {
  background: #cccccc;
  border: none;
  border-bottom: solid thin #999999;
}

DIV.figure TABLE {
  margin-left: auto;
  margin-right: auto;
}

DIV.figure CAPTION {
  caption-side: bottom;
  font-size: 120%;
  font-style: italic;
  font-weight: bold;
  margin-left: auto;
  margin-right: auto;
}

TH.label {
  text-align: right;
  vertical-align: top;
}

TH.sublabel {
  text-align: right;
  font-weight: normal;
}

HR {
  border: solid thin;
}

SPAN.info {
  background: black;
  border: thin solid black;
  color: white;
  font-size: 80%;
  font-style: italic;
  font-weight: bold;
  white-space: nowrap;
}

H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
  float: right;
  font-size: 100%;
}

H1.title {
}

H2.title, H3.title {
  border-bottom: solid 2pt #000000;
}

DIV.indent, TABLE.indent {
  margin-top: 2em;
  margin-left: auto;
  margin-right: auto;
  width: 90%;
}

TABLE.indent {
  border-collapse: collapse;
}

TABLE.indent TD, TABLE.indent TH {
  padding: 0;
}

TABLE.list {
  border-collapse: collapse;
  margin-left: auto;
  margin-right: auto;
  width: 90%;
}

TABLE.list TH {
  background: white;
  border-bottom: solid thin #cccccc;
  color: #444444;
  padding-top: 10pt;
  padding-left: 5pt;
  text-align: left;
  vertical-align: bottom;
  white-space: nowrap;
}

TABLE.list TH A {
  color: #4444cc;
}

TABLE.list TD {
  border-bottom: solid thin #eeeeee;
  padding-top: 5pt;
  padding-left: 5pt;
}

TABLE.list TR:nth-child(even) {
  background: #f8f8f8;
}

TABLE.list TR:nth-child(odd) {
  background: #f4f4f4;
}

DT {
  margin-left: 36pt;
  margin-top: 12pt;
}

DD {
  margin-left: 54pt;
}

DL.category DT {
  font-weight: bold;
}

P.summary {
  margin-left: 36pt;
  font-family: monaco, courier, monospace;
}

DIV.summary TABLE {
  border: solid thin #999999;
  border-collapse: collapse;
  border-spacing: 0;
  margin: 10px;
}

DIV.summary TABLE TD, DIV.summary TABLE TH {
  border: solid thin #999999;
  padding: 5px;
  text-align: left;
  vertical-align: top;
}

DIV.summary TABLE THEAD TH {
  background: #eeeeee;
}

/* API documentation styles... */
div.body h1 {
  margin: 0;
}
div.body h2 {
  margin-top: 1.5em;
}
div.body h3, div.body h4, div.body h5 {
  margin-bottom: 0.5em;
  margin-top: 1.5em;
}
.class, .enumeration, .function, .struct, .typedef, .union {
  border-bottom: solid thin #999999;
  margin-bottom: 0;
  margin-top: 2em;
}
.description {
  margin-top: 0.5em;
}
code, p.code, pre, ul.code li {
  font-family: monaco, courier, monospace;
  font-size: 90%;
}
ul.code, ul.contents, ul.subcontents {
  list-style-type: none;
  margin: 0;
  padding-left: 0;
}
ul.code li {
  margin: 0;
}
ul.contents > li {
  margin-top: 1em;
}
ul.contents li ul.code, ul.contents li ul.subcontents {
  padding-left: 2em;
}
div.body dl {
  margin-left: 0;
  margin-top: 0;
}
div.body dt {
  font-style: italic;
  margin-left: 0;
  margin-top: 0;
}
div.body dd {
  margin-bottom: 0.5em;
}

/* This is just for the HTML files generated with the framedhelp target */
div.contents {
  background: #e8e8e8;
  border: solid thin black;
  padding: 10px;
}
div.contents h1 {
  font-size: 110%;
}
div.contents h2 {
  font-size: 100%;
}
div.contents ul.contents {
  font-size: 80%;
}
div.contents ul.subcontents li {
  margin-left: 1em;
  text-indent: -1em;
}
--></style>
</head>
<body>
<div class='body'>
<!--
  "$Id$"

  PPD compiler documentation for CUPS.

  Copyright 2007-2012 by Apple Inc.
  Copyright 1997-2007 by Easy Software Products.

  These coded instructions, statements, and computer programs are the
  property of Apple Inc. and are protected by Federal copyright
  law.  Distribution and use rights are outlined in the file "LICENSE.txt"
  which should have been included with this file.  If this file is
  file is missing or damaged, see the license at "http://www.cups.org/".
-->

<h1 class='title'>Introduction to the PPD Compiler</h1>

<P>This document describes how to use the CUPS PostScript Printer Description
(PPD) file compiler. The PPD compiler generates PPD files from simple text files
that describe the features and capabilities of one or more printers.</P>

<BLOCKQUOTE><B>Note:</B>

<P>The PPD compiler and related tools are deprecated and will be removed in a future release of CUPS.</P>

</BLOCKQUOTE>

<div class='summary'><table summary='General Information'>
<tbody>
<tr>
	<th>See Also</th>
	<td>Programming: <a href='raster-driver.html'>Developing Raster Printer Drivers</a><br>
	Programming: <a href='postscript-driver.html'>Developing PostScript Printer Drivers</a><br>
	Programming: <a href='api-filter.html'>Filter and Backend Programming</a><br>
	Programming: <a href='api-raster.html'>Raster API</a><br>
	References: <a href='ref-ppdcfile.html'>PPD Compiler Driver Information File Reference</a><br>
	Specifications: <a href='spec-ppd.html'>CUPS PPD Extensions</a></td>
</tr>
</tbody>
</table></div>
<h2 class="title">Contents</h2>
<ul class="contents">
<li><a href="#BASICS">The Basics</a></li>
<li><a href="#DRV">Driver Information Files</a><ul class="subcontents">
	<li><a href="#SIMPLE">A Simple Example</a></li>
	<li><a href="#GROUPING">Grouping and Inheritance</a></li>
	<li><a href="#COLOR">Color Support</a></li>
	<li><a href="#OPTIONS">Defining Custom Options and Option Groups</a></li>
	<li><a href="#DEFINE">Defining Constants</a></li>
	<li><a href="#CONDITIONAL">Conditional Statements</a></li>
	<li><a href="#CONSTRAINTS">Defining Constraints</a></li>
</ul></li>
<li><a href="#LOCALIZATION">Localization</a><ul class="subcontents">
	<li><a href="#PPDPO">The ppdpo Utility</a></li>
	<li><a href="#PPDC_CATALOG">Using Message Catalogs with the PPD Compiler</a></li>
</ul></li>
</ul>
<h2 class='title'><a name='BASICS'>The Basics</a></h2>

<P>The PPD compiler, <a href='man-ppdc.html'><code>ppdc(1)</code></a>, is a
simple command-line tool that takes a single <I>driver information file</I>,
which by convention uses the extension <VAR>.drv</VAR>, and produces one or more
PPD files that may be distributed with your printer drivers for use with CUPS.
For example, you would run the following command to create the English language
PPD files defined by the driver information file <VAR>mydrivers.drv</VAR>:</P>

<pre class='command'>
ppdc mydrivers.drv
</pre>

<P>The PPD files are placed in a subdirectory called
<VAR>ppd</VAR>. The <TT>-d</TT> option is used to put the PPD
files in a different location, for example:</p>

<pre class='command'>
ppdc -d myppds mydrivers.drv
</pre>

<P>places the PPD files in a subdirectory named
<VAR>myppds</VAR>. Finally, use the <TT>-l</TT> option to
specify the language localization for the PPD files that are
created, for example:</P>

<pre class='command'>
ppdc -d myppds/de -l de mydrivers.drv
ppdc -d myppds/en -l en mydrivers.drv
ppdc -d myppds/es -l es mydrivers.drv
ppdc -d myppds/fr -l fr mydrivers.drv
ppdc -d myppds/it -l it mydrivers.drv
</pre>

<P>creates PPD files in German (de), English (en), Spanish (es),
French (fr), and Italian (it) in the corresponding
subdirectories. Specify multiple languages (separated by commas) to produce
"globalized" PPD files:</p>

<pre class='command'>
ppdc -d myppds -l de,en,es,fr,it mydrivers.drv
</pre>


<h2 class='title'><a name='DRV'>Driver Information Files</a></h2>

<P>The driver information files accepted by the PPD compiler are
plain text files that define the various attributes and options
that are included in the PPD files that are generated. A driver
information file can define the information for one or more printers and
their corresponding PPD files.</P>

<p class='example'><a name="LISTING1">Listing 1: "examples/minimum.drv"</a></p>

<pre class='example'>
<I>// Include standard font and media definitions</I>
<a href='ref-ppdcfile.html#_include'>#include</a> &lt;font.defs&gt;
<a href='ref-ppdcfile.html#_include'>#include</a> &lt;media.defs&gt;

<I>// List the fonts that are supported, in this case all standard fonts...</I>
<a href='ref-ppdcfile.html#Font'>Font</a> *

<I>// Manufacturer, model name, and version</I>
<a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "Foo"
<a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
<a href='ref-ppdcfile.html#Version'>Version</a> 1.0

<I>// Each filter provided by the driver...</I>
<a href='ref-ppdcfile.html#Filter'>Filter</a> application/vnd.cups-raster 100 rastertofoo

<I>// Supported page sizes</I>
*<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Letter
<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> A4

<I>// Supported resolutions</I>
*<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "600dpi/600 DPI"

<I>// Specify the name of the PPD file we want to generate...</I>
<a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd"
</pre>


<h3><a name='SIMPLE'>A Simple Example</a></h3>

<P>The example in <A HREF="#LISTING1">Listing 1</A> shows a driver information
file which defines the minimum required attributes to provide a valid PPD file.
The first part of the file includes standard definition files for fonts and
media sizes:</P>

<pre class='example'>
<a href='ref-ppdcfile.html#_include'>#include</a> &lt;font.defs&gt;
<a href='ref-ppdcfile.html#_include'>#include</a> &lt;media.defs&gt;
</pre>

<P>The <TT>#include</TT> directive works just like the C/C++ include directive;
files included using the angle brackets (<TT>&lt;filename&gt;</TT>) are found
in any of the standard include directories and files included using quotes
(<TT>"filename"</TT>) are found in the same directory as the source or include
file. The <TT>&lt;font.defs&gt;</TT> include file defines the standard fonts
which are included with GPL Ghostscript and the Apple PDF RIP, while the
<TT>&lt;media.defs&gt;</TT> include file defines the standard media sizes
listed in Appendix B of the Adobe PostScript Printer Description File Format
Specification.</P>

<P>CUPS provides several other standard include files:</P>

<UL>

	<LI><TT>&lt;epson.h&gt;</TT> - Defines all of the rastertoepson driver
	constants.</LI>

	<LI><TT>&lt;escp.h&gt;</TT> - Defines all of the rastertoescpx driver
	constants.</LI>

	<LI><TT>&lt;hp.h&gt;</TT> - Defines all of the rastertohp driver
	constants.</LI>

	<LI><TT>&lt;label.h&gt;</TT> - Defines all of the rastertolabel driver
	constants.</LI>

	<LI><TT>&lt;pcl.h&gt;</TT> - Defines all of the rastertopclx driver
	constants.</LI>

	<LI><TT>&lt;raster.defs&gt;</TT> - Defines all of the CUPS raster format
	constants.</LI>

</UL>

<P>Next we list all of the fonts that are available in the driver; for CUPS
raster drivers, the following line is all that is usually supplied:</P>

<pre class='example'>
<a href='ref-ppdcfile.html#Font'>Font</a> *
</pre>

<P>The <TT>Font</TT> directive specifies the name of a single font or the
asterisk to specify all fonts. For example, you would use the following line to
define an additional bar code font that you are supplying with your printer
driver:</P>

<pre class='example'>
<I>//   name         encoding  version  charset  status</I>
<a href='ref-ppdcfile.html#Font'>Font</a> Barcode-Foo  Special   "(1.0)"  Special  ROM
</pre>

<P>The name of the font is <TT>Barcode-Foo</TT>. Since it is not a standard
text font, the encoding and charset name <TT>Special</TT> is used. The version
number is <TT>1.0</TT> and the status (where the font is located) is
<TT>ROM</TT> to indicate that the font does not need to be embedded in
documents that use the font for this printer.</P>

<P>Third comes the manufacturer, model name, and version number information
strings:</P>

<pre class='example'>
<a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "Foo"
<a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
<a href='ref-ppdcfile.html#Version'>Version</a> 1.0
</pre>

<P>These strings are used when the user (or auto-configuration program) selects
the printer driver for a newly connected device.</p>

<P>The list of filters comes after the information strings; for the example in
<A HREF="#LISTING1">Listing 1</A>, we have a single filter that takes CUPS
raster data:</P>

<pre class='example'>
<a href='ref-ppdcfile.html#Filter'>Filter</a> application/vnd.cups-raster 100 rastertofoo
</pre>

<P>Each filter specified in the driver information file is the equivalent of a
printer driver for that format; if a user submits a print job in a different
format, CUPS figures out the sequence of commands that will produce a supported
format for the least relative cost.</P>

<P>Once we have defined the driver information we specify the supported options.
For the example driver we support a single resolution of 600 dots per inch and
two media sizes, A4 and Letter:</P>

<pre class='example'>
*<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Letter
<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> A4

*<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "600dpi/600 DPI"
</pre>

<P>The asterisk in front of the <TT>MediaSize</TT> and <TT>Resolution</TT>
directives specify that those option choices are the default. The
<TT>MediaSize</TT> directive is followed by a media size name which is normally
defined in the <TT>&lt;media.defs&gt;</TT> file and corresponds to a standard
Adobe media size name. If the default media size is <TT>Letter</TT>, the PPD
compiler will override it to be <TT>A4</TT> for non-English localizations for
you automatically.</P>

<P>The <TT>Resolution</TT> directive accepts several values after it as
follows:</P>

<OL>

	<LI>Colorspace for this resolution, if any. In the example file, the
	colorspace <TT>k</TT> is used which corresponds to black. For printer
	drivers that support color printing, this field is usually specified as
	"-" for "no change".</LI>

	<LI>Bits per color. In the example file, we define 8 bits per color, for
	a continuous-tone grayscale output. All versions of CUPS support 1 and
	8 bits per color.  CUPS 1.2 and higher (OS X 10.5 and higher) also
	supports 16 bits per color.</LI>

	<LI>Rows per band. In the example file, we define 0 rows per band to
	indicate that our printer driver does not process the page in
	bands.</LI>

	<LI>Row feed. In the example, we define the feed value to be 0 to
	indicate that our printer driver does not interleave the output.</LI>

	<LI>Row step. In the example, we define the step value to be 0 to
	indicate that our printer driver does not interleave the output. This
	value normally indicates the spacing between the nozzles of an inkjet
	printer - when combined with the previous two values, it informs the
	driver how to stagger the output on the page to produce interleaved
	lines on the page for higher-resolution output.</LI>

	<LI>Choice name and text. In the example, we define the choice name and
	text to be <TT>"600dpi/600 DPI"</TT>. The name and text are separated by
	slash (<TT>/</TT>) character; if no text is specified, then the name is
	used as the text. The PPD compiler parses the name to determine the
	actual resolution; the name can be of the form
	<TT><I>RESOLUTION</I>dpi</TT> for resolutions that are equal
	horizontally and vertically or <TT><I>HRES</I>x<I>VRES</I>dpi</TT> for
	isometric resolutions. Only integer resolution values are supported, so
	a resolution name of <TT>300dpi</TT> is valid while <TT>300.1dpi</TT> is
	not.</LI>

</OL>

<P>Finally, the <TT>PCFileName</TT> directive specifies that the named PPD file
should be written for the current driver definitions:</P>

<pre class='example'>
<a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd"
</pre>

<P>The filename follows the directive and <I>must</I> conform to the Adobe
filename requirements in the Adobe Postscript Printer Description File Format
Specification. Specifically, the filename may not exceed 8 characters followed
by the extension <VAR>.ppd</VAR>. The <TT>FileName</TT> directive can be used to
specify longer filenames:</P>

<pre class='example'>
<a href='ref-ppdcfile.html#FileName'>FileName</a> "FooJet 2000"
</pre>


<h3><a name='GROUPING'>Grouping and Inheritance</a></h3>

<P>The previous example created a single PPD file. Driver information files can
also define multiple printers by using the PPD compiler grouping functionality.
Directives are grouped using the curly braces (<TT>{</TT> and <TT>}</TT>) and
every group that uses the <TT>PCFileName</TT> or <TT>FileName</TT> directives
produces a PPD file with that name. <A HREF="#LISTING2">Listing 2</A> shows a
variation of the original example that uses two groups to define two printers
that share the same printer driver filter but provide two different resolution
options.</P>

<p class='example'><a name="LISTING2">Listing 2: "examples/grouping.drv"</a></p>

<pre class='example'>

<I>// Include standard font and media definitions</I>
<a href='ref-ppdcfile.html#_include'>#include</a> &lt;font.defs&gt;
<a href='ref-ppdcfile.html#_include'>#include</a> &lt;media.defs&gt;

<I>// List the fonts that are supported, in this case all standard fonts...</I>
<a href='ref-ppdcfile.html#Font'>Font</a> *

<I>// Manufacturer and version</I>
<a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "Foo"
<a href='ref-ppdcfile.html#Version'>Version</a> 1.0

<I>// Each filter provided by the driver...</I>
<a href='ref-ppdcfile.html#Filter'>Filter</a> application/vnd.cups-raster 100 rastertofoo

<I>// Supported page sizes</I>
*<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Letter
<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> A4

{
  <I>// Supported resolutions</I>
  *<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "600dpi/600 DPI"

  <I>// Specify the model name and filename...</I>
  <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
  <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd"
}

{
  <I>// Supported resolutions</I>
  *<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "1200dpi/1200 DPI"

  <I>// Specify the model name and filename...</I>
  <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2001"
  <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojt2k1.ppd"
}
</pre>

<P>The second example is essentially the same as the first, except that each
printer model is defined inside of a pair of curly braces. For example, the
first printer is defined using:</P>

<pre class='example'>
{
  // Supported resolutions
  *<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "600dpi/600 DPI"

  // Specify the model name and filename...
  <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
  <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd"
}
</pre>

<P>The printer <I>inherits</I> all of the definitions from the parent group (the
top part of the file) and adds the additional definitions inside the curly
braces for that printer driver. When we define the second group, it also
inherits the same definitions from the parent group but <I>none</I> of the
definitions from the first driver. Groups can be nested to any number of levels
to support variations of similar models without duplication of information.</P>


<h3><a name='COLOR'>Color Support</a></h3>

<P>For printer drivers that support color printing, the
<TT>ColorDevice</TT> and <TT>ColorModel</TT> directives should be
used to tell the printing system that color output is desired
and in what formats. <A HREF="#LISTING3">Listing 3</A> shows a
variation of the previous example which includes a color printer
that supports printing at 300 and 600 DPI.</P>

<P>The key changes are the addition of the <TT>ColorDevice</TT>
directive:</P>

<pre class='example'>
<a href='ref-ppdcfile.html#ColorDevice'>ColorDevice</a> true
</pre>

<P>which tells the printing system that the printer supports
color printing, and the <TT>ColorModel</TT> directives:</P>

<pre class='example'>
<a href='ref-ppdcfile.html#ColorModel'>ColorModel</a> Gray/Grayscale w chunky 0
*<a href='ref-ppdcfile.html#ColorModel'>ColorModel</a> RGB/Color rgb chunky 0
</pre>

<P>which tell the printing system which colorspaces are supported by the printer
driver for color printing. Each of the <TT>ColorModel</TT> directives is
followed by the option name and text (<TT>Gray/Grayscale</TT> and
<TT>RGB/Color</TT>), the colorspace name (<TT>w</TT> and <TT>rgb</TT>), the
color organization (<TT>chunky</TT>), and the compression mode number
(<TT>0</TT>) to be passed to the driver. The option name can be any of the
standard Adobe <TT>ColorModel</TT> names:</P>

<UL>

	<LI><TT>Gray</TT> - Grayscale output.

	<LI><TT>RGB</TT> - Color output, typically using the RGB
	colorspace, but without a separate black channel.

	<LI><TT>CMYK</TT> - Color output with a separate black
	channel.

</UL>

<P>Custom names can be used, however it is recommended that you use your vendor
prefix for any custom names, for example "fooName".</P>

<P>The colorspace name can be any of the following universally supported
colorspaces:</P>

<UL>
	<LI><TT>w</TT> - Luminance</LI>

	<LI><TT>rgb</TT> - Red, green, blue</LI>

	<LI><TT>k</TT> - Black</LI>

	<LI><TT>cmy</TT> - Cyan, magenta, yellow</LI>

	<LI><TT>cmyk</TT> - Cyan, magenta, yellow, black</LI>

</UL>

<P>The color organization can be any of the following values:</P>

<UL>

	<LI><TT>chunky</TT> - Color values are passed together on a line
	as RGB RGB RGB RGB</LI>

	<LI><TT>banded</TT> - Color values are passed separately
	on a line as RRRR GGGG BBBB; not supported by the Apple
	RIP filters</LI>

	<LI><TT>planar</TT> - Color values are passed separately
	on a page as RRRR RRRR RRRR ... GGGG GGGG GGGG ... BBBB
	BBBB BBBB; not supported by the Apple RIP filters</LI>

</UL>

<P>The compression mode value is passed to the driver in the
<TT>cupsCompression</TT> attribute. It is traditionally used to select an
appropriate compression mode for the color model but can be used for any
purpose, such as specifying a photo mode vs. standard mode.</P>

<p class='example'><a name="LISTING3">Listing 3: "examples/color.drv"</a></p>

<pre class='example'>

<I>// Include standard font and media definitions</I>
<a href='ref-ppdcfile.html#_include'>#include</a> &lt;font.defs&gt;
<a href='ref-ppdcfile.html#_include'>#include</a> &lt;media.defs&gt;

<I>// List the fonts that are supported, in this case all standard fonts...</I>
<a href='ref-ppdcfile.html#Font'>Font</a> *

<I>// Manufacturer and version</I>
<a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "Foo"
<a href='ref-ppdcfile.html#Version'>Version</a> 1.0

<I>// Each filter provided by the driver...</I>
<a href='ref-ppdcfile.html#Filter'>Filter</a> application/vnd.cups-raster 100 rastertofoo

<I>// Supported page sizes</I>
*<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Letter
<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> A4

{
  <I>// Supported resolutions</I>
  *<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "600dpi/600 DPI"

  <I>// Specify the model name and filename...</I>
  <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
  <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd"
}

{
  <I>// Supports color printing</I>
  <a href='ref-ppdcfile.html#ColorDevice'>ColorDevice</a> true

  <I>// Supported colorspaces</I>
  <a href='ref-ppdcfile.html#ColorModel'>ColorModel</a> Gray/Grayscale w chunky 0
  *<a href='ref-ppdcfile.html#ColorModel'>ColorModel</a> RGB/Color rgb chunky 0

  <I>// Supported resolutions</I>
  *<a href='ref-ppdcfile.html#Resolution'>Resolution</a> - 8 0 0 0 "300dpi/300 DPI"
  <a href='ref-ppdcfile.html#Resolution'>Resolution</a> - 8 0 0 0 "600dpi/600 DPI"

  <I>// Specify the model name and filename...</I>
  <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet Color"
  <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojetco.ppd"
}
</pre>


<h3><a name='OPTIONS'>Defining Custom Options and Option Groups</a></h3>

<P>The <TT>Group</TT>, <TT>Option</TT>, and <TT>Choice</TT>
directives are used to define or select a group, option, or
choice. <A HREF="#LISTING4">Listing 4</A> shows a variation of
the first example that provides two custom options in a group
named "Footasm".</P>

<p class='example'><a name="LISTING4">Listing 4: "examples/custom.drv"</a></p>

<pre class='example'>

<I>// Include standard font and media definitions</I>
<a href='ref-ppdcfile.html#_include'>#include</a> &lt;font.defs&gt;
<a href='ref-ppdcfile.html#_include'>#include</a> &lt;media.defs&gt;

<I>// List the fonts that are supported, in this case all standard fonts...</I>
<a href='ref-ppdcfile.html#Font'>Font</a> *

<I>// Manufacturer, model name, and version</I>
<a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "Foo"
<a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
<a href='ref-ppdcfile.html#Version'>Version</a> 1.0

<I>// Each filter provided by the driver...</I>
<a href='ref-ppdcfile.html#Filter'>Filter</a> application/vnd.cups-raster 100 rastertofoo

<I>// Supported page sizes</I>
*<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Letter
<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> A4

<I>// Supported resolutions</I>
*<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "600dpi/600 DPI"

<I>// Option Group</I>
<a href='ref-ppdcfile.html#Group'>Group</a> "Footasm"

  <I>// Boolean option</I>
  <a href='ref-ppdcfile.html#Option'>Option</a> "fooEnhance/Resolution Enhancement" Boolean AnySetup 10
    *<a href='ref-ppdcfile.html#Choice'>Choice</a> True/Yes "&lt;&lt;/cupsCompression 1&gt;&gt;setpagedevice"
    <a href='ref-ppdcfile.html#Choice'>Choice</a> False/No "&lt;&lt;/cupsCompression 0&gt;&gt;setpagedevice"

  <I>// Multiple choice option</I>
  <a href='ref-ppdcfile.html#Option'>Option</a> "fooOutputType/Output Quality" PickOne AnySetup 10
    *<a href='ref-ppdcfile.html#Choice'>Choice</a> "Auto/Automatic Selection"
            "&lt;&lt;/OutputType(Auto)&gt;&gt;setpagedevice""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "Text/Optimize for Text"
            "&lt;&lt;/OutputType(Text)&gt;&gt;setpagedevice""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "Graph/Optimize for Graphics"
            "&lt;&lt;/OutputType(Graph)&gt;&gt;setpagedevice""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "Photo/Optimize for Photos"
            "&lt;&lt;/OutputType(Photo)&gt;&gt;setpagedevice""

<I>// Specify the name of the PPD file we want to generate...</I>
<a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd"
</pre>

<P>The custom group is introduced by the <TT>Group</TT>
directive which is followed by the name and optionally text for
the user:</P>

<pre class='example'>
<a href='ref-ppdcfile.html#Group'>Group</a> "Footasm/Footastic Options"
</pre>

<P>The group name must conform to the PPD specification and
cannot exceed 40 characters in length. If you specify user text,
it cannot exceed 80 characters in length. The groups
<TT>General</TT>, <TT>Extra</TT>, and
<TT>InstallableOptions</TT> are predefined by CUPS; the general
and extra groups are filled by the UI options defined by the PPD
specification. The <TT>InstallableOptions</TT> group is reserved
for options that define whether accessories for the printer
(duplexer unit, finisher, stapler, etc.) are installed.</P>

<P>Once the group is specified, the <TT>Option</TT> directive is
used to introduce a new option:</P>

<pre class='example'>
<a href='ref-ppdcfile.html#Option'>Option</a> "fooEnhance/Resolution Enhancement" Boolean AnySetup 10
</pre>

<P>The directive is followed by the name of the option and any
optional user text, the option type, the PostScript document group, and
the sort order number. The option name must conform to the PPD specification
and cannot exceed 40 characters in length. If you specify user text, it
cannot exceed 80 characters in length.</P>

<P>The option type can be <TT>Boolean</TT> for true/false
selections, <TT>PickOne</TT> for picking one of many choices, or
<TT>PickMany</TT> for picking zero or more choices. Boolean
options can have at most two choices with the names
<TT>False</TT> and <TT>True</TT>. Pick options can have any
number of choices, although for Windows compatibility reasons
the number of choices should not exceed 255.</P>

<P>The PostScript document group is typically <TT>AnySetup</TT>,
meaning that the option can be introduced at any point in the
PostScript document. Other values include <TT>PageSetup</TT> to
include the option before each page and <TT>DocumentSetup</TT>
to include the option once at the beginning of the document.</P>

<P>The sort order number is used to sort the printer commands
associated with each option choice within the PostScript
document. This allows you to setup certain options before others
as required by the printer. For most CUPS raster printer
drivers, the value <TT>10</TT> can be used for all options.</P>

<P>Once the option is specified, each option choice can be
listed using the <TT>Choice</TT> directive:</P>

<pre class='example'>
*<a href='ref-ppdcfile.html#Choice'>Choice</a> True/Yes "&lt;&lt;/cupsCompression 1&gt;&gt;setpagedevice"
<a href='ref-ppdcfile.html#Choice'>Choice</a> False/No "&lt;&lt;/cupsCompression 0&gt;&gt;setpagedevice"
</pre>

<P>The directive is followed by the choice name and optionally
user text, and the PostScript commands that should be inserted
when printing a file to this printer. The option name must
conform to the PPD specification and cannot exceed 40 characters
in length. If you specify user text, it cannot exceed 80
characters in length.</P>

<P>The PostScript commands are also interpreted by any RIP
filters, so these commands typically must be present for all
option choices. Most commands take the form:</P>

<pre class='example'>
&lt;&lt;/name value&gt;&gt;setpagedevice
</pre>

<P>where <TT>name</TT> is the name of the PostScript page device
attribute and <TT>value</TT> is the numeric or string value for
that attribute.</P>


<h3><a name='DEFINE'>Defining Constants</a></h3>

<P>Sometimes you will want to define constants for your drivers
so that you can share values in different groups within the same
driver information file, or to share values between different
driver information files using the <TT>#include</TT> directive.
The <TT>#define</TT> directive is used to define constants for
use in your printer definitions:</P>

<pre class='example'>
<a href='ref-ppdcfile.html#_define'>#define</a> NAME value
</pre>

<P>The <TT>NAME</TT> is any sequence of letters, numbers, and
the underscore. The <TT>value</TT> is a number or string; if the
value contains spaces you must put double quotes around it, for
example:</P>

<pre class='example'>
<a href='ref-ppdcfile.html#_define'>#define</a> FOO "My String Value"
</pre>

<P>Constants can also be defined on the command-line using the <tt>-D</tt>
option:</P>

<pre class='command'>
ppdc -DNAME="value" filename.drv
</pre>

<P>Once defined, you use the notation <TT>$NAME</TT> to substitute the value of
the constant in the file, for example:</P>

<pre class='example'>
<a href='ref-ppdcfile.html#_define'>#define</a> MANUFACTURER "Foo"
<a href='ref-ppdcfile.html#_define'>#define</a> FOO_600      0
<a href='ref-ppdcfile.html#_define'>#define</a> FOO_1200     1

{
  <a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "$MANUFACTURER"
  <a href='ref-ppdcfile.html#ModelNumber'>ModelNumber</a> $FOO_600
  <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
  ...
}

{
  <a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "$MANUFACTURER"
  <a href='ref-ppdcfile.html#ModelNumber'>ModelNumber</a> $FOO_1200
  <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2001"
  ...
}
</pre>

<P>Numeric constants can be bitwise OR'd together by placing the constants
inside parenthesis, for example:</P>

<pre class='example'>
<I>// ModelNumber capability bits</I>
<a href='ref-ppdcfile.html#_define'>#define</a> DUPLEX 1
<a href='ref-ppdcfile.html#_define'>#define</a> COLOR  2

...

{
  <I>// Define a model number specifying the capabilities of the printer...</I>
  <a href='ref-ppdcfile.html#ModelNumber'>ModelNumber</a> ($DUPLEX $COLOR)
  ...
}
</pre>


<h3><a name='CONDITIONAL'>Conditional Statements</a></h3>

<p>The PPD compiler supports conditional compilation using the <tt>#if</tt>,
<tt>#elif</tt>, <tt>#else</tt>, and <tt>#endif</tt> directives. The <tt>#if</tt>
and <tt>#elif</tt> directives are followed by a constant name or an expression.
For example, to include a group of options when "ADVANCED" is defined:</p>

<pre class='example'>
<a href='ref-ppdcfile.html#_if'>#if</a> ADVANCED
<a href='ref-ppdcfile.html#Group'>Group</a> "Advanced/Advanced Options"
  <a href='ref-ppdcfile.html#Option'>Option</a> "fooCyanAdjust/Cyan Adjustment"
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus10/+10%" ""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus5/+5%" ""
    *<a href='ref-ppdcfile.html#Choice'>Choice</a> "none/No Adjustment" ""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus5/-5%" ""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus10/-10%" ""
  <a href='ref-ppdcfile.html#Option'>Option</a> "fooMagentaAdjust/Magenta Adjustment"
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus10/+10%" ""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus5/+5%" ""
    *<a href='ref-ppdcfile.html#Choice'>Choice</a> "none/No Adjustment" ""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus5/-5%" ""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus10/-10%" ""
  <a href='ref-ppdcfile.html#Option'>Option</a> "fooYellowAdjust/Yellow Adjustment"
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus10/+10%" ""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus5/+5%" ""
    *<a href='ref-ppdcfile.html#Choice'>Choice</a> "none/No Adjustment" ""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus5/-5%" ""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus10/-10%" ""
  <a href='ref-ppdcfile.html#Option'>Option</a> "fooBlackAdjust/Black Adjustment"
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus10/+10%" ""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "plus5/+5%" ""
    *<a href='ref-ppdcfile.html#Choice'>Choice</a> "none/No Adjustment" ""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus5/-5%" ""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "minus10/-10%" ""
<a href='ref-ppdcfile.html#_endif'>#endif</a>
</pre>


<h3><a name='CONSTRAINTS'>Defining Constraints</a></h3>

<P>Constraints are strings that are used to specify that one or more option
choices are incompatible, for example two-sided printing on transparency media.
Constraints are also used to prevent the use of uninstalled features such as the
duplexer unit, additional media trays, and so forth.</P>

<P>The <TT>UIConstraints</TT> directive is used to specify a constraint that is
placed in the PPD file. The directive is followed by a string using one of the
following formats:</P>

<pre class='example'>
<a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Option1 *Option2"
<a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Option1 Choice1 *Option2"
<a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Option1 *Option2 Choice2"
<a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Option1 Choice1 *Option2 Choice2"
</pre>

<P>Each option name is preceded by the asterisk (<TT>*</TT>). If no choice is
given for an option, then all choices <I>except</I> <TT>False</TT> and
<TT>None</TT> will conflict with the other option and choice(s). Since the PPD
compiler automatically adds reciprocal constraints (option A conflicts with
option B, so therefore option B conflicts with option A), you need only specify
the constraint once.</P>

<p class='example'><a name="LISTING5">Listing 5: "examples/constraint.drv"</a></p>

<pre class='example'>

<I>// Include standard font and media definitions</I>
<a href='ref-ppdcfile.html#_include'>#include</a> &lt;font.defs&gt;
<a href='ref-ppdcfile.html#_include'>#include</a> &lt;media.defs&gt;

<I>// List the fonts that are supported, in this case all standard fonts...</I>
<a href='ref-ppdcfile.html#Font'>Font</a> *

<I>// Manufacturer, model name, and version</I>
<a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "Foo"
<a href='ref-ppdcfile.html#ModelName'>ModelName</a> "FooJet 2000"
<a href='ref-ppdcfile.html#Version'>Version</a> 1.0

<I>// Each filter provided by the driver...</I>
<a href='ref-ppdcfile.html#Filter'>Filter</a> application/vnd.cups-raster 100 rastertofoo

<I>// Supported page sizes</I>
*<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Letter
<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> A4

<I>// Supported resolutions</I>
*<a href='ref-ppdcfile.html#Resolution'>Resolution</a> k 8 0 0 0 "600dpi/600 DPI"

<I>// Installable Option Group</I>
<a href='ref-ppdcfile.html#Group'>Group</a> "InstallableOptions/Options Installed"

  <I>// Duplexing unit option</I>
  <a href='ref-ppdcfile.html#Option'>Option</a> "OptionDuplexer/Duplexing Unit" Boolean AnySetup 10
    <a href='ref-ppdcfile.html#Choice'>Choice</a> True/Installed ""
    *<a href='ref-ppdcfile.html#Choice'>Choice</a> "False/Not Installed" ""

<I>// General Option Group</I>
<a href='ref-ppdcfile.html#Group'>Group</a> General

  <I>// Duplexing option</I>
  <a href='ref-ppdcfile.html#Option'>Option</a> "Duplex/Two-Sided Printing" PickOne AnySetup 10
    *<a href='ref-ppdcfile.html#Choice'>Choice</a> "None/No" "&lt;&lt;/Duplex false&gt;&gt;setpagedevice""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "DuplexNoTumble/Long Edge Binding"
           "&lt;&lt;/Duplex true/Tumble false&gt;&gt;setpagedevice""
    <a href='ref-ppdcfile.html#Choice'>Choice</a> "DuplexTumble/Short Edge Binding"
           "&lt;&lt;/Duplex true/Tumble true&gt;&gt;setpagedevice""

<I>// Only allow duplexing if the duplexer is installed</I>
<a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Duplex *OptionDuplexer False"

<I>// Specify the name of the PPD file we want to generate...</I>
<a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd"
</pre>

<P><A HREF="#LISTING5">Listing 5</A> shows a variation of the first example with
an added <TT>Duplex</TT> option and installable option for the duplexer,
<TT>OptionDuplex</TT>. A constraint is added at the end to specify that any
choice of the <TT>Duplex</TT> option that is not <TT>None</TT> is incompatible
with the "Duplexer Installed" option set to "Not Installed"
(<TT>False</TT>):</P>

<pre class='example'>
<a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Duplex *OptionDuplexer False"
</pre>

<h4>Enhanced Constraints</h4>

<p>CUPS 1.4 supports constraints between 2 or more options using the
<TT>Attribute</TT> directive. <TT>cupsUIConstraints</TT> attributes define
the constraints, while <TT>cupsUIResolver</TT> attributes define option changes
to resolve constraints. For example, we can specify the previous duplex
constraint with a resolver that turns off duplexing with the following two
lines:</p>

<pre class='example'>
<a href='ref-ppdcfile.html#Attribute'>Attribute</a> cupsUIConstraints DuplexOff "*Duplex *OptionDuplexer False"
<a href='ref-ppdcfile.html#Attribute'>Attribute</a> cupsUIResolver DuplexOff "*Duplex None"
</pre>

<h2 class='title'><a name='LOCALIZATION'>Localization</a></h2>

<p>The PPD compiler provides localization of PPD files in different languages
through <i>message catalog</i> files in the GNU gettext or Apple .strings
formats. Each user text string and several key PPD attribute values such as
<tt>LanguageVersion</tt> and <tt>LanguageEncoding</tt> are looked up in the
corresponding message catalog and the translated text is substituted in the
generated PPD files. One message catalog file can be used by multiple driver
information files, and each file contains a single language translation.</p>

<h3><a name='PPDPO'>The ppdpo Utility</a></h3>

<p>While CUPS includes localizations of all standard media sizes and options in
several languages, your driver information files may provide their own media
sizes and options that need to be localized. CUPS provides a utility program to
aid in the localization of drivers called <a
href='man-ppdpo.html'><tt>ppdpo(1)</tt></a>. The <tt>ppdpo</tt> program creates
or updates a message catalog file based upon one or more driver information
files. New messages are added with the word "TRANSLATE" added to the front of
the translation string to make locating new strings for translation easier. The
program accepts the message catalog filename and one or more driver information
files.</p>

<p>For example, run the following command to create a new German message catalog
called <var>de.po</var> for all of the driver information files in the current
directory:</p>

<pre class='command'>
ppdpo -o de.po *.drv
</pre>

<p>If the file <var>de.po</var> already exists, <tt>ppdpo</tt> will update the
contents of the file with any new messages that need to be translated. To create
an Apple .strings file instead, specify the output filename with a .strings
extension, for example:</p>

<pre class='command'>
ppdpo -o de.strings *.drv
</pre>

<h3><a name='PPDC_CATALOG'>Using Message Catalogs with the PPD Compiler</a></h3>

<p>Once you have created a message catalog, use the <a
href='ref-ppdcfile.html#_po'><tt>#po</tt></a> directive to declare it in each
driver information file. For example, to declare the German message catalog for
a driver use:</p>

<pre class='example'>
<a href='ref-ppdcfile.html#_po'>#po</a> de "de.po"  // German
</pre>

<p>In fact, you can use the <tt>#po</tt> directive as many times as needed:</p>

<pre class='example'>
<a href='ref-ppdcfile.html#_po'>#po</a> de "de.po"  // German
<a href='ref-ppdcfile.html#_po'>#po</a> es "es.po"  // Spanish
<a href='ref-ppdcfile.html#_po'>#po</a> fr "fr.po"  // French
<a href='ref-ppdcfile.html#_po'>#po</a> it "it.po"  // Italian
<a href='ref-ppdcfile.html#_po'>#po</a> ja "ja.po"  // Japanese
</pre>

<p>The filename ("de.po", etc.) can be relative to the location of the driver
information file or an absolute path. Once defined, the PPD compiler will
automatically generate a globalized PPD for every language declared in your
driver information file. To generate a single-language PPD file, simply use the
<tt>-l</tt> option to list the corresponding locale, for example:</p>

<pre class='command'>
ppdc -l de -d ppd/de mydrivers.drv
</pre>

<p>to generate German PPD files.</p>
</div>
</body>
</html>