3 <!-- SECTION: Programming -->
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.2">
9 <meta name=
"author" content=
"Unknown">
10 <meta name=
"copyright" content=
"Unknown">
11 <meta name=
"version" content=
"0.0">
12 <style type=
"text/css"><!--
14 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
17 H1, H2, H3, H4, H5, H6, P, TD, TH {
18 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
21 H1 { font-size: 2em; }
22 H2 { font-size: 1.75em; }
23 H3 { font-size: 1.5em; }
24 H4 { font-size: 1.25em; }
27 font-family: monaco, courier, monospace;
32 font-family: monaco, courier, monospace;
36 border-left: solid 2px #777;
45 PRE.command, PRE.example {
72 PRE.command EM, PRE.example EM {
73 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
77 font-family: monaco, courier, monospace;
93 -moz-border-radius: 10px;
98 text-decoration: none;
101 A:link:hover, A:visited:hover, A:active {
102 text-decoration: underline;
109 TR.data, TD.data, TR.data TD {
112 border-bottom: solid 1pt #999999;
116 border-bottom: solid 1pt #999999;
123 border: solid thin #999999;
124 border-collapse: collapse;
140 border: solid thin #cccccc;
147 border-bottom: solid thin #999999;
156 caption-side: bottom;
180 border: thin solid black;
188 H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
197 border-bottom: solid 2pt #000000;
200 DIV.indent, TABLE.indent {
208 border-collapse: collapse;
211 TABLE.indent TD, TABLE.indent TH {
216 border-collapse: collapse;
224 border-bottom: solid thin #cccccc;
229 vertical-align: bottom;
238 border-bottom: solid thin #eeeeee;
243 TABLE.list TR:nth-child(even) {
247 TABLE.list TR:nth-child(odd) {
266 font-family: monaco, courier, monospace;
270 border: solid thin #999999;
271 border-collapse: collapse;
276 DIV.summary TABLE TD, DIV.summary TABLE TH {
277 border: solid thin #999999;
283 DIV.summary TABLE THEAD TH {
287 /* API documentation styles... */
299 margin-bottom: 0.5em;
304 margin-bottom: 0.5em;
309 margin-bottom: 0.5em;
314 border: solid thin black;
323 div.contents ul.contents {
327 border-bottom: solid 2px gray;
337 border-bottom: solid 2px gray;
340 border-bottom: solid 2px gray;
352 border-bottom: solid 2px gray;
355 border-bottom: solid 2px gray;
358 border-bottom: solid 2px gray;
362 h1, h2, h3, h4, h5, h6 {
363 page-break-inside: avoid;
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;
371 p 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;
376 -webkit-hyphens: manual;
377 page-break-inside: avoid;
379 p.code, pre, ul.code li {
386 text-decoration: none;
390 border: solid thin black;
397 h2 span.info, h3 span.info, h4 span.info {
403 h2.title span.info, h3.title span.info, h4.title span.info {
404 border-bottom-left-radius: 0px;
405 border-bottom-right-radius: 0px;
410 ul.code, ul.contents, ul.subcontents {
411 list-style-type: none;
421 ul.contents li ul.code, ul.contents li ul.subcontents {
425 border-collapse: collapse;
428 table.list tr:nth-child(even) {
429 background: rgba(127,127,127,0.1);]n}
431 border-right: 2px solid gray;
432 font-family: monospace;
433 padding: 5px 10px 5px 2px;
438 padding: 5px 2px 5px 10px;
445 border-bottom: solid 2px black;
448 border-bottom: solid 2px black;
455 PPD compiler documentation for CUPS.
457 Copyright © 2007-2012 by Apple Inc.
458 Copyright © 1997-2007 by Easy Software Products.
460 Licensed under Apache License v2.0. See the file "LICENSE" for more
464 <h1 class='title'
>Introduction to the PPD Compiler
</h1>
466 <P>This document describes how to use the CUPS PostScript Printer Description
467 (PPD) file compiler. The PPD compiler generates PPD files from simple text files
468 that describe the features and capabilities of one or more printers.
</P>
470 <BLOCKQUOTE><B>Note:
</B>
472 <P>The PPD compiler and related tools are deprecated and will be removed in a future release of CUPS.
</P>
476 <div class='summary'
><table summary='General Information'
>
480 <td>Programming:
<a href='raster-driver.html'
>Developing Raster Printer Drivers
</a><br>
481 Programming:
<a href='postscript-driver.html'
>Developing PostScript Printer Drivers
</a><br>
482 Programming:
<a href='api-filter.html'
>Filter and Backend Programming
</a><br>
483 Programming:
<a href='api-raster.html'
>Raster API
</a><br>
484 References:
<a href='ref-ppdcfile.html'
>PPD Compiler Driver Information File Reference
</a><br>
485 Specifications:
<a href='spec-ppd.html'
>CUPS PPD Extensions
</a></td>
490 <div class=
"contents">
491 <h2 class=
"title">Contents
</h2>
492 <ul class=
"contents">
493 <li><a href=
"#BASICS">The Basics
</a></li>
494 <li><a href=
"#DRV">Driver Information Files
</a><ul class=
"subcontents">
495 <li><a href=
"#SIMPLE">A Simple Example
</a></li>
496 <li><a href=
"#GROUPING">Grouping and Inheritance
</a></li>
497 <li><a href=
"#COLOR">Color Support
</a></li>
498 <li><a href=
"#OPTIONS">Defining Custom Options and Option Groups
</a></li>
499 <li><a href=
"#DEFINE">Defining Constants
</a></li>
500 <li><a href=
"#CONDITIONAL">Conditional Statements
</a></li>
501 <li><a href=
"#CONSTRAINTS">Defining Constraints
</a></li>
503 <li><a href=
"#LOCALIZATION">Localization
</a><ul class=
"subcontents">
504 <li><a href=
"#PPDPO">The ppdpo Utility
</a></li>
505 <li><a href=
"#PPDC_CATALOG">Using Message Catalogs with the PPD Compiler
</a></li>
510 <h2 class='title'
><a name='BASICS'
>The Basics
</a></h2>
512 <P>The PPD compiler,
<a href='man-ppdc.html'
><code>ppdc(
1)
</code></a>, is a
513 simple command-line tool that takes a single
<I>driver information file
</I>,
514 which by convention uses the extension
<VAR>.drv
</VAR>, and produces one or more
515 PPD files that may be distributed with your printer drivers for use with CUPS.
516 For example, you would run the following command to create the English language
517 PPD files defined by the driver information file
<VAR>mydrivers.drv
</VAR>:
</P>
519 <pre class='command'
>
523 <P>The PPD files are placed in a subdirectory called
524 <VAR>ppd
</VAR>. The
<TT>-d
</TT> option is used to put the PPD
525 files in a different location, for example:
</p>
527 <pre class='command'
>
528 ppdc -d myppds mydrivers.drv
531 <P>places the PPD files in a subdirectory named
532 <VAR>myppds
</VAR>. Finally, use the
<TT>-l
</TT> option to
533 specify the language localization for the PPD files that are
534 created, for example:
</P>
536 <pre class='command'
>
537 ppdc -d myppds/de -l de mydrivers.drv
538 ppdc -d myppds/en -l en mydrivers.drv
539 ppdc -d myppds/es -l es mydrivers.drv
540 ppdc -d myppds/fr -l fr mydrivers.drv
541 ppdc -d myppds/it -l it mydrivers.drv
544 <P>creates PPD files in German (de), English (en), Spanish (es),
545 French (fr), and Italian (it) in the corresponding
546 subdirectories. Specify multiple languages (separated by commas) to produce
547 "globalized" PPD files:
</p>
549 <pre class='command'
>
550 ppdc -d myppds -l de,en,es,fr,it mydrivers.drv
554 <h2 class='title'
><a name='DRV'
>Driver Information Files
</a></h2>
556 <P>The driver information files accepted by the PPD compiler are
557 plain text files that define the various attributes and options
558 that are included in the PPD files that are generated. A driver
559 information file can define the information for one or more printers and
560 their corresponding PPD files.
</P>
562 <p class='example'
><a name=
"LISTING1">Listing
1:
"examples/minimum.drv"</a></p>
564 <pre class='example'
>
565 <I>// Include standard font and media definitions
</I>
566 <a href='ref-ppdcfile.html#_include'
>#include
</a> <font.defs
>
567 <a href='ref-ppdcfile.html#_include'
>#include
</a> <media.defs
>
569 <I>// List the fonts that are supported, in this case all standard fonts...
</I>
570 <a href='ref-ppdcfile.html#Font'
>Font
</a> *
572 <I>// Manufacturer, model name, and version
</I>
573 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "Foo"
574 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
575 <a href='ref-ppdcfile.html#Version'
>Version
</a> 1.0
577 <I>// Each filter provided by the driver...
</I>
578 <a href='ref-ppdcfile.html#Filter'
>Filter
</a> application/vnd.cups-raster
100 rastertofoo
580 <I>// Supported page sizes
</I>
581 *
<a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> Letter
582 <a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> A4
584 <I>// Supported resolutions
</I>
585 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "600dpi/600 DPI"
587 <I>// Specify the name of the PPD file we want to generate...
</I>
588 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojet2k.ppd"
592 <h3><a name='SIMPLE'
>A Simple Example
</a></h3>
594 <P>The example in
<A HREF=
"#LISTING1">Listing
1</A> shows a driver information
595 file which defines the minimum required attributes to provide a valid PPD file.
596 The first part of the file includes standard definition files for fonts and
599 <pre class='example'
>
600 <a href='ref-ppdcfile.html#_include'
>#include
</a> <font.defs
>
601 <a href='ref-ppdcfile.html#_include'
>#include
</a> <media.defs
>
604 <P>The
<TT>#include
</TT> directive works just like the C/C++ include directive;
605 files included using the angle brackets (
<TT><filename
></TT>) are found
606 in any of the standard include directories and files included using quotes
607 (
<TT>"filename"</TT>) are found in the same directory as the source or include
608 file. The
<TT><font.defs
></TT> include file defines the standard fonts
609 which are included with GPL Ghostscript and the Apple PDF RIP, while the
610 <TT><media.defs
></TT> include file defines the standard media sizes
611 listed in Appendix B of the Adobe PostScript Printer Description File Format
614 <P>CUPS provides several other standard include files:
</P>
618 <LI><TT><epson.h
></TT> - Defines all of the rastertoepson driver
621 <LI><TT><escp.h
></TT> - Defines all of the rastertoescpx driver
624 <LI><TT><hp.h
></TT> - Defines all of the rastertohp driver
627 <LI><TT><label.h
></TT> - Defines all of the rastertolabel driver
630 <LI><TT><pcl.h
></TT> - Defines all of the rastertopclx driver
633 <LI><TT><raster.defs
></TT> - Defines all of the CUPS raster format
638 <P>Next we list all of the fonts that are available in the driver; for CUPS
639 raster drivers, the following line is all that is usually supplied:
</P>
641 <pre class='example'
>
642 <a href='ref-ppdcfile.html#Font'
>Font
</a> *
645 <P>The
<TT>Font
</TT> directive specifies the name of a single font or the
646 asterisk to specify all fonts. For example, you would use the following line to
647 define an additional bar code font that you are supplying with your printer
650 <pre class='example'
>
651 <I>// name encoding version charset status
</I>
652 <a href='ref-ppdcfile.html#Font'
>Font
</a> Barcode-Foo Special
"(1.0)" Special ROM
655 <P>The name of the font is
<TT>Barcode-Foo
</TT>. Since it is not a standard
656 text font, the encoding and charset name
<TT>Special
</TT> is used. The version
657 number is
<TT>1.0</TT> and the status (where the font is located) is
658 <TT>ROM
</TT> to indicate that the font does not need to be embedded in
659 documents that use the font for this printer.
</P>
661 <P>Third comes the manufacturer, model name, and version number information
664 <pre class='example'
>
665 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "Foo"
666 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
667 <a href='ref-ppdcfile.html#Version'
>Version
</a> 1.0
670 <P>These strings are used when the user (or auto-configuration program) selects
671 the printer driver for a newly connected device.
</p>
673 <P>The list of filters comes after the information strings; for the example in
674 <A HREF=
"#LISTING1">Listing
1</A>, we have a single filter that takes CUPS
677 <pre class='example'
>
678 <a href='ref-ppdcfile.html#Filter'
>Filter
</a> application/vnd.cups-raster
100 rastertofoo
681 <P>Each filter specified in the driver information file is the equivalent of a
682 printer driver for that format; if a user submits a print job in a different
683 format, CUPS figures out the sequence of commands that will produce a supported
684 format for the least relative cost.
</P>
686 <P>Once we have defined the driver information we specify the supported options.
687 For the example driver we support a single resolution of
600 dots per inch and
688 two media sizes, A4 and Letter:
</P>
690 <pre class='example'
>
691 *
<a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> Letter
692 <a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> A4
694 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "600dpi/600 DPI"
697 <P>The asterisk in front of the
<TT>MediaSize
</TT> and
<TT>Resolution
</TT>
698 directives specify that those option choices are the default. The
699 <TT>MediaSize
</TT> directive is followed by a media size name which is normally
700 defined in the
<TT><media.defs
></TT> file and corresponds to a standard
701 Adobe media size name. If the default media size is
<TT>Letter
</TT>, the PPD
702 compiler will override it to be
<TT>A4
</TT> for non-English localizations for
703 you automatically.
</P>
705 <P>The
<TT>Resolution
</TT> directive accepts several values after it as
710 <LI>Colorspace for this resolution, if any. In the example file, the
711 colorspace
<TT>k
</TT> is used which corresponds to black. For printer
712 drivers that support color printing, this field is usually specified as
713 "-" for
"no change".
</LI>
715 <LI>Bits per color. In the example file, we define
8 bits per color, for
716 a continuous-tone grayscale output. All versions of CUPS support
1 and
717 8 bits per color. CUPS
1.2 and higher (macOS
10.5 and higher) also
718 supports
16 bits per color.
</LI>
720 <LI>Rows per band. In the example file, we define
0 rows per band to
721 indicate that our printer driver does not process the page in
724 <LI>Row feed. In the example, we define the feed value to be
0 to
725 indicate that our printer driver does not interleave the output.
</LI>
727 <LI>Row step. In the example, we define the step value to be
0 to
728 indicate that our printer driver does not interleave the output. This
729 value normally indicates the spacing between the nozzles of an inkjet
730 printer - when combined with the previous two values, it informs the
731 driver how to stagger the output on the page to produce interleaved
732 lines on the page for higher-resolution output.
</LI>
734 <LI>Choice name and text. In the example, we define the choice name and
735 text to be
<TT>"600dpi/600 DPI"</TT>. The name and text are separated by
736 slash (
<TT>/
</TT>) character; if no text is specified, then the name is
737 used as the text. The PPD compiler parses the name to determine the
738 actual resolution; the name can be of the form
739 <TT><I>RESOLUTION
</I>dpi
</TT> for resolutions that are equal
740 horizontally and vertically or
<TT><I>HRES
</I>x
<I>VRES
</I>dpi
</TT> for
741 isometric resolutions. Only integer resolution values are supported, so
742 a resolution name of
<TT>300dpi
</TT> is valid while
<TT>300.1dpi
</TT> is
747 <P>Finally, the
<TT>PCFileName
</TT> directive specifies that the named PPD file
748 should be written for the current driver definitions:
</P>
750 <pre class='example'
>
751 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojet2k.ppd"
754 <P>The filename follows the directive and
<I>must
</I> conform to the Adobe
755 filename requirements in the Adobe Postscript Printer Description File Format
756 Specification. Specifically, the filename may not exceed
8 characters followed
757 by the extension
<VAR>.ppd
</VAR>. The
<TT>FileName
</TT> directive can be used to
758 specify longer filenames:
</P>
760 <pre class='example'
>
761 <a href='ref-ppdcfile.html#FileName'
>FileName
</a> "FooJet 2000"
765 <h3><a name='GROUPING'
>Grouping and Inheritance
</a></h3>
767 <P>The previous example created a single PPD file. Driver information files can
768 also define multiple printers by using the PPD compiler grouping functionality.
769 Directives are grouped using the curly braces (
<TT>{
</TT> and
<TT>}
</TT>) and
770 every group that uses the
<TT>PCFileName
</TT> or
<TT>FileName
</TT> directives
771 produces a PPD file with that name.
<A HREF=
"#LISTING2">Listing
2</A> shows a
772 variation of the original example that uses two groups to define two printers
773 that share the same printer driver filter but provide two different resolution
776 <p class='example'
><a name=
"LISTING2">Listing
2:
"examples/grouping.drv"</a></p>
778 <pre class='example'
>
780 <I>// Include standard font and media definitions
</I>
781 <a href='ref-ppdcfile.html#_include'
>#include
</a> <font.defs
>
782 <a href='ref-ppdcfile.html#_include'
>#include
</a> <media.defs
>
784 <I>// List the fonts that are supported, in this case all standard fonts...
</I>
785 <a href='ref-ppdcfile.html#Font'
>Font
</a> *
787 <I>// Manufacturer and version
</I>
788 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "Foo"
789 <a href='ref-ppdcfile.html#Version'
>Version
</a> 1.0
791 <I>// Each filter provided by the driver...
</I>
792 <a href='ref-ppdcfile.html#Filter'
>Filter
</a> application/vnd.cups-raster
100 rastertofoo
794 <I>// Supported page sizes
</I>
795 *
<a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> Letter
796 <a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> A4
799 <I>// Supported resolutions
</I>
800 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "600dpi/600 DPI"
802 <I>// Specify the model name and filename...
</I>
803 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
804 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojet2k.ppd"
808 <I>// Supported resolutions
</I>
809 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "1200dpi/1200 DPI"
811 <I>// Specify the model name and filename...
</I>
812 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2001"
813 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojt2k1.ppd"
817 <P>The second example is essentially the same as the first, except that each
818 printer model is defined inside of a pair of curly braces. For example, the
819 first printer is defined using:
</P>
821 <pre class='example'
>
823 // Supported resolutions
824 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "600dpi/600 DPI"
826 // Specify the model name and filename...
827 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
828 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojet2k.ppd"
832 <P>The printer
<I>inherits
</I> all of the definitions from the parent group (the
833 top part of the file) and adds the additional definitions inside the curly
834 braces for that printer driver. When we define the second group, it also
835 inherits the same definitions from the parent group but
<I>none
</I> of the
836 definitions from the first driver. Groups can be nested to any number of levels
837 to support variations of similar models without duplication of information.
</P>
840 <h3><a name='COLOR'
>Color Support
</a></h3>
842 <P>For printer drivers that support color printing, the
843 <TT>ColorDevice
</TT> and
<TT>ColorModel
</TT> directives should be
844 used to tell the printing system that color output is desired
845 and in what formats.
<A HREF=
"#LISTING3">Listing
3</A> shows a
846 variation of the previous example which includes a color printer
847 that supports printing at
300 and
600 DPI.
</P>
849 <P>The key changes are the addition of the
<TT>ColorDevice
</TT>
852 <pre class='example'
>
853 <a href='ref-ppdcfile.html#ColorDevice'
>ColorDevice
</a> true
856 <P>which tells the printing system that the printer supports
857 color printing, and the
<TT>ColorModel
</TT> directives:
</P>
859 <pre class='example'
>
860 <a href='ref-ppdcfile.html#ColorModel'
>ColorModel
</a> Gray/Grayscale w chunky
0
861 *
<a href='ref-ppdcfile.html#ColorModel'
>ColorModel
</a> RGB/Color rgb chunky
0
864 <P>which tell the printing system which colorspaces are supported by the printer
865 driver for color printing. Each of the
<TT>ColorModel
</TT> directives is
866 followed by the option name and text (
<TT>Gray/Grayscale
</TT> and
867 <TT>RGB/Color
</TT>), the colorspace name (
<TT>w
</TT> and
<TT>rgb
</TT>), the
868 color organization (
<TT>chunky
</TT>), and the compression mode number
869 (
<TT>0</TT>) to be passed to the driver. The option name can be any of the
870 standard Adobe
<TT>ColorModel
</TT> names:
</P>
874 <LI><TT>Gray
</TT> - Grayscale output.
876 <LI><TT>RGB
</TT> - Color output, typically using the RGB
877 colorspace, but without a separate black channel.
879 <LI><TT>CMYK
</TT> - Color output with a separate black
884 <P>Custom names can be used, however it is recommended that you use your vendor
885 prefix for any custom names, for example
"fooName".
</P>
887 <P>The colorspace name can be any of the following universally supported
891 <LI><TT>w
</TT> - Luminance
</LI>
893 <LI><TT>rgb
</TT> - Red, green, blue
</LI>
895 <LI><TT>k
</TT> - Black
</LI>
897 <LI><TT>cmy
</TT> - Cyan, magenta, yellow
</LI>
899 <LI><TT>cmyk
</TT> - Cyan, magenta, yellow, black
</LI>
903 <P>The color organization can be any of the following values:
</P>
907 <LI><TT>chunky
</TT> - Color values are passed together on a line
908 as RGB RGB RGB RGB
</LI>
910 <LI><TT>banded
</TT> - Color values are passed separately
911 on a line as RRRR GGGG BBBB; not supported by the Apple
914 <LI><TT>planar
</TT> - Color values are passed separately
915 on a page as RRRR RRRR RRRR ... GGGG GGGG GGGG ... BBBB
916 BBBB BBBB; not supported by the Apple RIP filters
</LI>
920 <P>The compression mode value is passed to the driver in the
921 <TT>cupsCompression
</TT> attribute. It is traditionally used to select an
922 appropriate compression mode for the color model but can be used for any
923 purpose, such as specifying a photo mode vs. standard mode.
</P>
925 <p class='example'
><a name=
"LISTING3">Listing
3:
"examples/color.drv"</a></p>
927 <pre class='example'
>
929 <I>// Include standard font and media definitions
</I>
930 <a href='ref-ppdcfile.html#_include'
>#include
</a> <font.defs
>
931 <a href='ref-ppdcfile.html#_include'
>#include
</a> <media.defs
>
933 <I>// List the fonts that are supported, in this case all standard fonts...
</I>
934 <a href='ref-ppdcfile.html#Font'
>Font
</a> *
936 <I>// Manufacturer and version
</I>
937 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "Foo"
938 <a href='ref-ppdcfile.html#Version'
>Version
</a> 1.0
940 <I>// Each filter provided by the driver...
</I>
941 <a href='ref-ppdcfile.html#Filter'
>Filter
</a> application/vnd.cups-raster
100 rastertofoo
943 <I>// Supported page sizes
</I>
944 *
<a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> Letter
945 <a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> A4
948 <I>// Supported resolutions
</I>
949 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "600dpi/600 DPI"
951 <I>// Specify the model name and filename...
</I>
952 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
953 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojet2k.ppd"
957 <I>// Supports color printing
</I>
958 <a href='ref-ppdcfile.html#ColorDevice'
>ColorDevice
</a> true
960 <I>// Supported colorspaces
</I>
961 <a href='ref-ppdcfile.html#ColorModel'
>ColorModel
</a> Gray/Grayscale w chunky
0
962 *
<a href='ref-ppdcfile.html#ColorModel'
>ColorModel
</a> RGB/Color rgb chunky
0
964 <I>// Supported resolutions
</I>
965 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> -
8 0 0 0 "300dpi/300 DPI"
966 <a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> -
8 0 0 0 "600dpi/600 DPI"
968 <I>// Specify the model name and filename...
</I>
969 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet Color"
970 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojetco.ppd"
975 <h3><a name='OPTIONS'
>Defining Custom Options and Option Groups
</a></h3>
977 <P>The
<TT>Group
</TT>,
<TT>Option
</TT>, and
<TT>Choice
</TT>
978 directives are used to define or select a group, option, or
979 choice.
<A HREF=
"#LISTING4">Listing
4</A> shows a variation of
980 the first example that provides two custom options in a group
983 <p class='example'
><a name=
"LISTING4">Listing
4:
"examples/custom.drv"</a></p>
985 <pre class='example'
>
987 <I>// Include standard font and media definitions
</I>
988 <a href='ref-ppdcfile.html#_include'
>#include
</a> <font.defs
>
989 <a href='ref-ppdcfile.html#_include'
>#include
</a> <media.defs
>
991 <I>// List the fonts that are supported, in this case all standard fonts...
</I>
992 <a href='ref-ppdcfile.html#Font'
>Font
</a> *
994 <I>// Manufacturer, model name, and version
</I>
995 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "Foo"
996 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
997 <a href='ref-ppdcfile.html#Version'
>Version
</a> 1.0
999 <I>// Each filter provided by the driver...
</I>
1000 <a href='ref-ppdcfile.html#Filter'
>Filter
</a> application/vnd.cups-raster
100 rastertofoo
1002 <I>// Supported page sizes
</I>
1003 *
<a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> Letter
1004 <a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> A4
1006 <I>// Supported resolutions
</I>
1007 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "600dpi/600 DPI"
1009 <I>// Option Group
</I>
1010 <a href='ref-ppdcfile.html#Group'
>Group
</a> "Footasm"
1012 <I>// Boolean option
</I>
1013 <a href='ref-ppdcfile.html#Option'
>Option
</a> "fooEnhance/Resolution Enhancement" Boolean AnySetup
10
1014 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> True/Yes
"<</cupsCompression 1>>setpagedevice"
1015 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> False/No
"<</cupsCompression 0>>setpagedevice"
1017 <I>// Multiple choice option
</I>
1018 <a href='ref-ppdcfile.html#Option'
>Option
</a> "fooOutputType/Output Quality" PickOne AnySetup
10
1019 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> "Auto/Automatic Selection"
1020 "<</OutputType(Auto)>>setpagedevice""
1021 <a href='ref-ppdcfile.html#Choice'>Choice</a> "Text/Optimize for Text
"
1022 "<</OutputType(Text)
>>setpagedevice
""
1023 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "Graph/Optimize for Graphics"
1024 "<</OutputType(Graph)>>setpagedevice""
1025 <a href='ref-ppdcfile.html#Choice'>Choice</a> "Photo/Optimize for Photos
"
1026 "<</OutputType(Photo)
>>setpagedevice
""
1028 <I>// Specify the name of the PPD file we want to generate...
</I>
1029 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojet2k.ppd"
1032 <P>The custom group is introduced by the
<TT>Group
</TT>
1033 directive which is followed by the name and optionally text for
1036 <pre class='example'
>
1037 <a href='ref-ppdcfile.html#Group'
>Group
</a> "Footasm/Footastic Options"
1040 <P>The group name must conform to the PPD specification and
1041 cannot exceed
40 characters in length. If you specify user text,
1042 it cannot exceed
80 characters in length. The groups
1043 <TT>General
</TT>,
<TT>Extra
</TT>, and
1044 <TT>InstallableOptions
</TT> are predefined by CUPS; the general
1045 and extra groups are filled by the UI options defined by the PPD
1046 specification. The
<TT>InstallableOptions
</TT> group is reserved
1047 for options that define whether accessories for the printer
1048 (duplexer unit, finisher, stapler, etc.) are installed.
</P>
1050 <P>Once the group is specified, the
<TT>Option
</TT> directive is
1051 used to introduce a new option:
</P>
1053 <pre class='example'
>
1054 <a href='ref-ppdcfile.html#Option'
>Option
</a> "fooEnhance/Resolution Enhancement" Boolean AnySetup
10
1057 <P>The directive is followed by the name of the option and any
1058 optional user text, the option type, the PostScript document group, and
1059 the sort order number. The option name must conform to the PPD specification
1060 and cannot exceed
40 characters in length. If you specify user text, it
1061 cannot exceed
80 characters in length.
</P>
1063 <P>The option type can be
<TT>Boolean
</TT> for true/false
1064 selections,
<TT>PickOne
</TT> for picking one of many choices, or
1065 <TT>PickMany
</TT> for picking zero or more choices. Boolean
1066 options can have at most two choices with the names
1067 <TT>False
</TT> and
<TT>True
</TT>. Pick options can have any
1068 number of choices, although for Windows compatibility reasons
1069 the number of choices should not exceed
255.
</P>
1071 <P>The PostScript document group is typically
<TT>AnySetup
</TT>,
1072 meaning that the option can be introduced at any point in the
1073 PostScript document. Other values include
<TT>PageSetup
</TT> to
1074 include the option before each page and
<TT>DocumentSetup
</TT>
1075 to include the option once at the beginning of the document.
</P>
1077 <P>The sort order number is used to sort the printer commands
1078 associated with each option choice within the PostScript
1079 document. This allows you to setup certain options before others
1080 as required by the printer. For most CUPS raster printer
1081 drivers, the value
<TT>10</TT> can be used for all options.
</P>
1083 <P>Once the option is specified, each option choice can be
1084 listed using the
<TT>Choice
</TT> directive:
</P>
1086 <pre class='example'
>
1087 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> True/Yes
"<</cupsCompression 1>>setpagedevice"
1088 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> False/No
"<</cupsCompression 0>>setpagedevice"
1091 <P>The directive is followed by the choice name and optionally
1092 user text, and the PostScript commands that should be inserted
1093 when printing a file to this printer. The option name must
1094 conform to the PPD specification and cannot exceed
40 characters
1095 in length. If you specify user text, it cannot exceed
80
1096 characters in length.
</P>
1098 <P>The PostScript commands are also interpreted by any RIP
1099 filters, so these commands typically must be present for all
1100 option choices. Most commands take the form:
</P>
1102 <pre class='example'
>
1103 <</name value
>>setpagedevice
1106 <P>where
<TT>name
</TT> is the name of the PostScript page device
1107 attribute and
<TT>value
</TT> is the numeric or string value for
1111 <h3><a name='DEFINE'
>Defining Constants
</a></h3>
1113 <P>Sometimes you will want to define constants for your drivers
1114 so that you can share values in different groups within the same
1115 driver information file, or to share values between different
1116 driver information files using the
<TT>#include
</TT> directive.
1117 The
<TT>#define
</TT> directive is used to define constants for
1118 use in your printer definitions:
</P>
1120 <pre class='example'
>
1121 <a href='ref-ppdcfile.html#_define'
>#define
</a> NAME value
1124 <P>The
<TT>NAME
</TT> is any sequence of letters, numbers, and
1125 the underscore. The
<TT>value
</TT> is a number or string; if the
1126 value contains spaces you must put double quotes around it, for
1129 <pre class='example'
>
1130 <a href='ref-ppdcfile.html#_define'
>#define
</a> FOO
"My String Value"
1133 <P>Constants can also be defined on the command-line using the
<tt>-D
</tt>
1136 <pre class='command'
>
1137 ppdc
-DNAME=
"value" filename.drv
1140 <P>Once defined, you use the notation
<TT>$NAME
</TT> to substitute the value of
1141 the constant in the file, for example:
</P>
1143 <pre class='example'
>
1144 <a href='ref-ppdcfile.html#_define'
>#define
</a> MANUFACTURER
"Foo"
1145 <a href='ref-ppdcfile.html#_define'
>#define
</a> FOO_600
0
1146 <a href='ref-ppdcfile.html#_define'
>#define
</a> FOO_1200
1
1149 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "$MANUFACTURER"
1150 <a href='ref-ppdcfile.html#ModelNumber'
>ModelNumber
</a> $FOO_600
1151 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
1156 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "$MANUFACTURER"
1157 <a href='ref-ppdcfile.html#ModelNumber'
>ModelNumber
</a> $FOO_1200
1158 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2001"
1163 <P>Numeric constants can be bitwise OR'd together by placing the constants
1164 inside parenthesis, for example:
</P>
1166 <pre class='example'
>
1167 <I>// ModelNumber capability bits
</I>
1168 <a href='ref-ppdcfile.html#_define'
>#define
</a> DUPLEX
1
1169 <a href='ref-ppdcfile.html#_define'
>#define
</a> COLOR
2
1174 <I>// Define a model number specifying the capabilities of the printer...
</I>
1175 <a href='ref-ppdcfile.html#ModelNumber'
>ModelNumber
</a> ($DUPLEX $COLOR)
1181 <h3><a name='CONDITIONAL'
>Conditional Statements
</a></h3>
1183 <p>The PPD compiler supports conditional compilation using the
<tt>#if
</tt>,
1184 <tt>#elif
</tt>,
<tt>#else
</tt>, and
<tt>#endif
</tt> directives. The
<tt>#if
</tt>
1185 and
<tt>#elif
</tt> directives are followed by a constant name or an expression.
1186 For example, to include a group of options when
"ADVANCED" is defined:
</p>
1188 <pre class='example'
>
1189 <a href='ref-ppdcfile.html#_if'
>#if
</a> ADVANCED
1190 <a href='ref-ppdcfile.html#Group'
>Group
</a> "Advanced/Advanced Options"
1191 <a href='ref-ppdcfile.html#Option'
>Option
</a> "fooCyanAdjust/Cyan Adjustment"
1192 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus10/+10%" ""
1193 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus5/+5%" ""
1194 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> "none/No Adjustment" ""
1195 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus5/-5%" ""
1196 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus10/-10%" ""
1197 <a href='ref-ppdcfile.html#Option'
>Option
</a> "fooMagentaAdjust/Magenta Adjustment"
1198 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus10/+10%" ""
1199 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus5/+5%" ""
1200 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> "none/No Adjustment" ""
1201 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus5/-5%" ""
1202 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus10/-10%" ""
1203 <a href='ref-ppdcfile.html#Option'
>Option
</a> "fooYellowAdjust/Yellow Adjustment"
1204 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus10/+10%" ""
1205 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus5/+5%" ""
1206 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> "none/No Adjustment" ""
1207 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus5/-5%" ""
1208 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus10/-10%" ""
1209 <a href='ref-ppdcfile.html#Option'
>Option
</a> "fooBlackAdjust/Black Adjustment"
1210 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus10/+10%" ""
1211 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus5/+5%" ""
1212 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> "none/No Adjustment" ""
1213 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus5/-5%" ""
1214 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus10/-10%" ""
1215 <a href='ref-ppdcfile.html#_endif'
>#endif
</a>
1219 <h3><a name='CONSTRAINTS'
>Defining Constraints
</a></h3>
1221 <P>Constraints are strings that are used to specify that one or more option
1222 choices are incompatible, for example two-sided printing on transparency media.
1223 Constraints are also used to prevent the use of uninstalled features such as the
1224 duplexer unit, additional media trays, and so forth.
</P>
1226 <P>The
<TT>UIConstraints
</TT> directive is used to specify a constraint that is
1227 placed in the PPD file. The directive is followed by a string using one of the
1228 following formats:
</P>
1230 <pre class='example'
>
1231 <a href='ref-ppdcfile.html#UIConstraints'
>UIConstraints
</a> "*Option1 *Option2"
1232 <a href='ref-ppdcfile.html#UIConstraints'
>UIConstraints
</a> "*Option1 Choice1 *Option2"
1233 <a href='ref-ppdcfile.html#UIConstraints'
>UIConstraints
</a> "*Option1 *Option2 Choice2"
1234 <a href='ref-ppdcfile.html#UIConstraints'
>UIConstraints
</a> "*Option1 Choice1 *Option2 Choice2"
1237 <P>Each option name is preceded by the asterisk (
<TT>*
</TT>). If no choice is
1238 given for an option, then all choices
<I>except
</I> <TT>False
</TT> and
1239 <TT>None
</TT> will conflict with the other option and choice(s). Since the PPD
1240 compiler automatically adds reciprocal constraints (option A conflicts with
1241 option B, so therefore option B conflicts with option A), you need only specify
1242 the constraint once.
</P>
1244 <p class='example'
><a name=
"LISTING5">Listing
5:
"examples/constraint.drv"</a></p>
1246 <pre class='example'
>
1248 <I>// Include standard font and media definitions
</I>
1249 <a href='ref-ppdcfile.html#_include'
>#include
</a> <font.defs
>
1250 <a href='ref-ppdcfile.html#_include'
>#include
</a> <media.defs
>
1252 <I>// List the fonts that are supported, in this case all standard fonts...
</I>
1253 <a href='ref-ppdcfile.html#Font'
>Font
</a> *
1255 <I>// Manufacturer, model name, and version
</I>
1256 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "Foo"
1257 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
1258 <a href='ref-ppdcfile.html#Version'
>Version
</a> 1.0
1260 <I>// Each filter provided by the driver...
</I>
1261 <a href='ref-ppdcfile.html#Filter'
>Filter
</a> application/vnd.cups-raster
100 rastertofoo
1263 <I>// Supported page sizes
</I>
1264 *
<a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> Letter
1265 <a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> A4
1267 <I>// Supported resolutions
</I>
1268 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "600dpi/600 DPI"
1270 <I>// Installable Option Group
</I>
1271 <a href='ref-ppdcfile.html#Group'
>Group
</a> "InstallableOptions/Options Installed"
1273 <I>// Duplexing unit option
</I>
1274 <a href='ref-ppdcfile.html#Option'
>Option
</a> "OptionDuplexer/Duplexing Unit" Boolean AnySetup
10
1275 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> True/Installed
""
1276 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> "False/Not Installed" ""
1278 <I>// General Option Group
</I>
1279 <a href='ref-ppdcfile.html#Group'
>Group
</a> General
1281 <I>// Duplexing option
</I>
1282 <a href='ref-ppdcfile.html#Option'
>Option
</a> "Duplex/Two-Sided Printing" PickOne AnySetup
10
1283 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> "None/No" "<</Duplex false>>setpagedevice""
1284 <a href='ref-ppdcfile.html#Choice'>Choice</a> "DuplexNoTumble/Long Edge Binding
"
1285 "<</Duplex true/Tumble false
>>setpagedevice
""
1286 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "DuplexTumble/Short Edge Binding"
1287 "<</Duplex true/Tumble true>>setpagedevice""
1289 <I>// Only allow duplexing if the duplexer is installed</I>
1290 <a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Duplex *OptionDuplexer False
"
1292 <I>// Specify the name of the PPD file we want to generate...</I>
1293 <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd
"
1296 <P><A HREF="#LISTING5
">Listing 5</A> shows a variation of the first example with
1297 an added <TT>Duplex</TT> option and installable option for the duplexer,
1298 <TT>OptionDuplex</TT>. A constraint is added at the end to specify that any
1299 choice of the <TT>Duplex</TT> option that is not <TT>None</TT> is incompatible
1300 with the "Duplexer Installed
" option set to "Not Installed
"
1301 (<TT>False</TT>):</P>
1303 <pre class='example'>
1304 <a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Duplex *OptionDuplexer False
"
1307 <h4>Enhanced Constraints</h4>
1309 <p>CUPS 1.4 supports constraints between 2 or more options using the
1310 <TT>Attribute</TT> directive. <TT>cupsUIConstraints</TT> attributes define
1311 the constraints, while <TT>cupsUIResolver</TT> attributes define option changes
1312 to resolve constraints. For example, we can specify the previous duplex
1313 constraint with a resolver that turns off duplexing with the following two
1316 <pre class='example'>
1317 <a href='ref-ppdcfile.html#Attribute'>Attribute</a> cupsUIConstraints DuplexOff "*Duplex *OptionDuplexer False
"
1318 <a href='ref-ppdcfile.html#Attribute'>Attribute</a> cupsUIResolver DuplexOff "*Duplex None
"
1321 <h2 class='title'><a name='LOCALIZATION'>Localization</a></h2>
1323 <p>The PPD compiler provides localization of PPD files in different languages
1324 through <i>message catalog</i> files in the GNU gettext or Apple .strings
1325 formats. Each user text string and several key PPD attribute values such as
1326 <tt>LanguageVersion</tt> and <tt>LanguageEncoding</tt> are looked up in the
1327 corresponding message catalog and the translated text is substituted in the
1328 generated PPD files. One message catalog file can be used by multiple driver
1329 information files, and each file contains a single language translation.</p>
1331 <h3><a name='PPDPO'>The ppdpo Utility</a></h3>
1333 <p>While CUPS includes localizations of all standard media sizes and options in
1334 several languages, your driver information files may provide their own media
1335 sizes and options that need to be localized. CUPS provides a utility program to
1336 aid in the localization of drivers called <a
1337 href='man-ppdpo.html'><tt>ppdpo(1)</tt></a>. The <tt>ppdpo</tt> program creates
1338 or updates a message catalog file based upon one or more driver information
1339 files. New messages are added with the word "TRANSLATE
" added to the front of
1340 the translation string to make locating new strings for translation easier. The
1341 program accepts the message catalog filename and one or more driver information
1344 <p>For example, run the following command to create a new German message catalog
1345 called <var>de.po</var> for all of the driver information files in the current
1348 <pre class='command'>
1349 ppdpo -o de.po *.drv
1352 <p>If the file <var>de.po</var> already exists, <tt>ppdpo</tt> will update the
1353 contents of the file with any new messages that need to be translated. To create
1354 an Apple .strings file instead, specify the output filename with a .strings
1355 extension, for example:</p>
1357 <pre class='command'>
1358 ppdpo -o de.strings *.drv
1361 <h3><a name='PPDC_CATALOG'>Using Message Catalogs with the PPD Compiler</a></h3>
1363 <p>Once you have created a message catalog, use the <a
1364 href='ref-ppdcfile.html#_po'><tt>#po</tt></a> directive to declare it in each
1365 driver information file. For example, to declare the German message catalog for
1368 <pre class='example'>
1369 <a href='ref-ppdcfile.html#_po'>#po</a> de "de.po
" // German
1372 <p>In fact, you can use the <tt>#po</tt> directive as many times as needed:</p>
1374 <pre class='example'>
1375 <a href='ref-ppdcfile.html#_po'>#po</a> de "de.po
" // German
1376 <a href='ref-ppdcfile.html#_po'>#po</a> es "es.po
" // Spanish
1377 <a href='ref-ppdcfile.html#_po'>#po</a> fr "fr.po
" // French
1378 <a href='ref-ppdcfile.html#_po'>#po</a> it "it.po
" // Italian
1379 <a href='ref-ppdcfile.html#_po'>#po</a> ja "ja.po
" // Japanese
1382 <p>The filename ("de.po
", etc.) can be relative to the location of the driver
1383 information file or an absolute path. Once defined, the PPD compiler will
1384 automatically generate a globalized PPD for every language declared in your
1385 driver information file. To generate a single-language PPD file, simply use the
1386 <tt>-l</tt> option to list the corresponding locale, for example:</p>
1388 <pre class='command'>
1389 ppdc -l de -d ppd/de mydrivers.drv
1392 <p>to generate German PPD files.</p>