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.1">
9 <meta name=
"author" content=
"Unknown">
10 <meta name=
"copyright" content=
"Unknown">
11 <meta name=
"version" content=
"0.0">
12 <style type=
"text/css"><!--
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;
454 PPD compiler documentation for CUPS.
456 Copyright © 2007-2012 by Apple Inc.
457 Copyright © 1997-2007 by Easy Software Products.
459 Licensed under Apache License v2.0. See the file "LICENSE" for more
463 <h1 class='title'
>Introduction to the PPD Compiler
</h1>
465 <P>This document describes how to use the CUPS PostScript Printer Description
466 (PPD) file compiler. The PPD compiler generates PPD files from simple text files
467 that describe the features and capabilities of one or more printers.
</P>
469 <BLOCKQUOTE><B>Note:
</B>
471 <P>The PPD compiler and related tools are deprecated and will be removed in a future release of CUPS.
</P>
475 <div class='summary'
><table summary='General Information'
>
479 <td>Programming:
<a href='raster-driver.html'
>Developing Raster Printer Drivers
</a><br>
480 Programming:
<a href='postscript-driver.html'
>Developing PostScript Printer Drivers
</a><br>
481 Programming:
<a href='api-filter.html'
>Filter and Backend Programming
</a><br>
482 Programming:
<a href='api-raster.html'
>Raster API
</a><br>
483 References:
<a href='ref-ppdcfile.html'
>PPD Compiler Driver Information File Reference
</a><br>
484 Specifications:
<a href='spec-ppd.html'
>CUPS PPD Extensions
</a></td>
488 <div class=
"contents">
489 <h2 class=
"title">Contents
</h2>
490 <ul class=
"contents">
491 <li><a href=
"#BASICS">The Basics
</a></li>
492 <li><a href=
"#DRV">Driver Information Files
</a><ul class=
"subcontents">
493 <li><a href=
"#SIMPLE">A Simple Example
</a></li>
494 <li><a href=
"#GROUPING">Grouping and Inheritance
</a></li>
495 <li><a href=
"#COLOR">Color Support
</a></li>
496 <li><a href=
"#OPTIONS">Defining Custom Options and Option Groups
</a></li>
497 <li><a href=
"#DEFINE">Defining Constants
</a></li>
498 <li><a href=
"#CONDITIONAL">Conditional Statements
</a></li>
499 <li><a href=
"#CONSTRAINTS">Defining Constraints
</a></li>
501 <li><a href=
"#LOCALIZATION">Localization
</a><ul class=
"subcontents">
502 <li><a href=
"#PPDPO">The ppdpo Utility
</a></li>
503 <li><a href=
"#PPDC_CATALOG">Using Message Catalogs with the PPD Compiler
</a></li>
508 <h2 class='title'
><a name='BASICS'
>The Basics
</a></h2>
510 <P>The PPD compiler,
<a href='man-ppdc.html'
><code>ppdc(
1)
</code></a>, is a
511 simple command-line tool that takes a single
<I>driver information file
</I>,
512 which by convention uses the extension
<VAR>.drv
</VAR>, and produces one or more
513 PPD files that may be distributed with your printer drivers for use with CUPS.
514 For example, you would run the following command to create the English language
515 PPD files defined by the driver information file
<VAR>mydrivers.drv
</VAR>:
</P>
517 <pre class='command'
>
521 <P>The PPD files are placed in a subdirectory called
522 <VAR>ppd
</VAR>. The
<TT>-d
</TT> option is used to put the PPD
523 files in a different location, for example:
</p>
525 <pre class='command'
>
526 ppdc -d myppds mydrivers.drv
529 <P>places the PPD files in a subdirectory named
530 <VAR>myppds
</VAR>. Finally, use the
<TT>-l
</TT> option to
531 specify the language localization for the PPD files that are
532 created, for example:
</P>
534 <pre class='command'
>
535 ppdc -d myppds/de -l de mydrivers.drv
536 ppdc -d myppds/en -l en mydrivers.drv
537 ppdc -d myppds/es -l es mydrivers.drv
538 ppdc -d myppds/fr -l fr mydrivers.drv
539 ppdc -d myppds/it -l it mydrivers.drv
542 <P>creates PPD files in German (de), English (en), Spanish (es),
543 French (fr), and Italian (it) in the corresponding
544 subdirectories. Specify multiple languages (separated by commas) to produce
545 "globalized" PPD files:
</p>
547 <pre class='command'
>
548 ppdc -d myppds -l de,en,es,fr,it mydrivers.drv
552 <h2 class='title'
><a name='DRV'
>Driver Information Files
</a></h2>
554 <P>The driver information files accepted by the PPD compiler are
555 plain text files that define the various attributes and options
556 that are included in the PPD files that are generated. A driver
557 information file can define the information for one or more printers and
558 their corresponding PPD files.
</P>
560 <p class='example'
><a name=
"LISTING1">Listing
1:
"examples/minimum.drv"</a></p>
562 <pre class='example'
>
563 <I>// Include standard font and media definitions
</I>
564 <a href='ref-ppdcfile.html#_include'
>#include
</a> <font.defs
>
565 <a href='ref-ppdcfile.html#_include'
>#include
</a> <media.defs
>
567 <I>// List the fonts that are supported, in this case all standard fonts...
</I>
568 <a href='ref-ppdcfile.html#Font'
>Font
</a> *
570 <I>// Manufacturer, model name, and version
</I>
571 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "Foo"
572 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
573 <a href='ref-ppdcfile.html#Version'
>Version
</a> 1.0
575 <I>// Each filter provided by the driver...
</I>
576 <a href='ref-ppdcfile.html#Filter'
>Filter
</a> application/vnd.cups-raster
100 rastertofoo
578 <I>// Supported page sizes
</I>
579 *
<a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> Letter
580 <a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> A4
582 <I>// Supported resolutions
</I>
583 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "600dpi/600 DPI"
585 <I>// Specify the name of the PPD file we want to generate...
</I>
586 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojet2k.ppd"
590 <h3><a name='SIMPLE'
>A Simple Example
</a></h3>
592 <P>The example in
<A HREF=
"#LISTING1">Listing
1</A> shows a driver information
593 file which defines the minimum required attributes to provide a valid PPD file.
594 The first part of the file includes standard definition files for fonts and
597 <pre class='example'
>
598 <a href='ref-ppdcfile.html#_include'
>#include
</a> <font.defs
>
599 <a href='ref-ppdcfile.html#_include'
>#include
</a> <media.defs
>
602 <P>The
<TT>#include
</TT> directive works just like the C/C++ include directive;
603 files included using the angle brackets (
<TT><filename
></TT>) are found
604 in any of the standard include directories and files included using quotes
605 (
<TT>"filename"</TT>) are found in the same directory as the source or include
606 file. The
<TT><font.defs
></TT> include file defines the standard fonts
607 which are included with GPL Ghostscript and the Apple PDF RIP, while the
608 <TT><media.defs
></TT> include file defines the standard media sizes
609 listed in Appendix B of the Adobe PostScript Printer Description File Format
612 <P>CUPS provides several other standard include files:
</P>
616 <LI><TT><epson.h
></TT> - Defines all of the rastertoepson driver
619 <LI><TT><escp.h
></TT> - Defines all of the rastertoescpx driver
622 <LI><TT><hp.h
></TT> - Defines all of the rastertohp driver
625 <LI><TT><label.h
></TT> - Defines all of the rastertolabel driver
628 <LI><TT><pcl.h
></TT> - Defines all of the rastertopclx driver
631 <LI><TT><raster.defs
></TT> - Defines all of the CUPS raster format
636 <P>Next we list all of the fonts that are available in the driver; for CUPS
637 raster drivers, the following line is all that is usually supplied:
</P>
639 <pre class='example'
>
640 <a href='ref-ppdcfile.html#Font'
>Font
</a> *
643 <P>The
<TT>Font
</TT> directive specifies the name of a single font or the
644 asterisk to specify all fonts. For example, you would use the following line to
645 define an additional bar code font that you are supplying with your printer
648 <pre class='example'
>
649 <I>// name encoding version charset status
</I>
650 <a href='ref-ppdcfile.html#Font'
>Font
</a> Barcode-Foo Special
"(1.0)" Special ROM
653 <P>The name of the font is
<TT>Barcode-Foo
</TT>. Since it is not a standard
654 text font, the encoding and charset name
<TT>Special
</TT> is used. The version
655 number is
<TT>1.0</TT> and the status (where the font is located) is
656 <TT>ROM
</TT> to indicate that the font does not need to be embedded in
657 documents that use the font for this printer.
</P>
659 <P>Third comes the manufacturer, model name, and version number information
662 <pre class='example'
>
663 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "Foo"
664 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
665 <a href='ref-ppdcfile.html#Version'
>Version
</a> 1.0
668 <P>These strings are used when the user (or auto-configuration program) selects
669 the printer driver for a newly connected device.
</p>
671 <P>The list of filters comes after the information strings; for the example in
672 <A HREF=
"#LISTING1">Listing
1</A>, we have a single filter that takes CUPS
675 <pre class='example'
>
676 <a href='ref-ppdcfile.html#Filter'
>Filter
</a> application/vnd.cups-raster
100 rastertofoo
679 <P>Each filter specified in the driver information file is the equivalent of a
680 printer driver for that format; if a user submits a print job in a different
681 format, CUPS figures out the sequence of commands that will produce a supported
682 format for the least relative cost.
</P>
684 <P>Once we have defined the driver information we specify the supported options.
685 For the example driver we support a single resolution of
600 dots per inch and
686 two media sizes, A4 and Letter:
</P>
688 <pre class='example'
>
689 *
<a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> Letter
690 <a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> A4
692 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "600dpi/600 DPI"
695 <P>The asterisk in front of the
<TT>MediaSize
</TT> and
<TT>Resolution
</TT>
696 directives specify that those option choices are the default. The
697 <TT>MediaSize
</TT> directive is followed by a media size name which is normally
698 defined in the
<TT><media.defs
></TT> file and corresponds to a standard
699 Adobe media size name. If the default media size is
<TT>Letter
</TT>, the PPD
700 compiler will override it to be
<TT>A4
</TT> for non-English localizations for
701 you automatically.
</P>
703 <P>The
<TT>Resolution
</TT> directive accepts several values after it as
708 <LI>Colorspace for this resolution, if any. In the example file, the
709 colorspace
<TT>k
</TT> is used which corresponds to black. For printer
710 drivers that support color printing, this field is usually specified as
711 "-" for
"no change".
</LI>
713 <LI>Bits per color. In the example file, we define
8 bits per color, for
714 a continuous-tone grayscale output. All versions of CUPS support
1 and
715 8 bits per color. CUPS
1.2 and higher (macOS
10.5 and higher) also
716 supports
16 bits per color.
</LI>
718 <LI>Rows per band. In the example file, we define
0 rows per band to
719 indicate that our printer driver does not process the page in
722 <LI>Row feed. In the example, we define the feed value to be
0 to
723 indicate that our printer driver does not interleave the output.
</LI>
725 <LI>Row step. In the example, we define the step value to be
0 to
726 indicate that our printer driver does not interleave the output. This
727 value normally indicates the spacing between the nozzles of an inkjet
728 printer - when combined with the previous two values, it informs the
729 driver how to stagger the output on the page to produce interleaved
730 lines on the page for higher-resolution output.
</LI>
732 <LI>Choice name and text. In the example, we define the choice name and
733 text to be
<TT>"600dpi/600 DPI"</TT>. The name and text are separated by
734 slash (
<TT>/
</TT>) character; if no text is specified, then the name is
735 used as the text. The PPD compiler parses the name to determine the
736 actual resolution; the name can be of the form
737 <TT><I>RESOLUTION
</I>dpi
</TT> for resolutions that are equal
738 horizontally and vertically or
<TT><I>HRES
</I>x
<I>VRES
</I>dpi
</TT> for
739 isometric resolutions. Only integer resolution values are supported, so
740 a resolution name of
<TT>300dpi
</TT> is valid while
<TT>300.1dpi
</TT> is
745 <P>Finally, the
<TT>PCFileName
</TT> directive specifies that the named PPD file
746 should be written for the current driver definitions:
</P>
748 <pre class='example'
>
749 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojet2k.ppd"
752 <P>The filename follows the directive and
<I>must
</I> conform to the Adobe
753 filename requirements in the Adobe Postscript Printer Description File Format
754 Specification. Specifically, the filename may not exceed
8 characters followed
755 by the extension
<VAR>.ppd
</VAR>. The
<TT>FileName
</TT> directive can be used to
756 specify longer filenames:
</P>
758 <pre class='example'
>
759 <a href='ref-ppdcfile.html#FileName'
>FileName
</a> "FooJet 2000"
763 <h3><a name='GROUPING'
>Grouping and Inheritance
</a></h3>
765 <P>The previous example created a single PPD file. Driver information files can
766 also define multiple printers by using the PPD compiler grouping functionality.
767 Directives are grouped using the curly braces (
<TT>{
</TT> and
<TT>}
</TT>) and
768 every group that uses the
<TT>PCFileName
</TT> or
<TT>FileName
</TT> directives
769 produces a PPD file with that name.
<A HREF=
"#LISTING2">Listing
2</A> shows a
770 variation of the original example that uses two groups to define two printers
771 that share the same printer driver filter but provide two different resolution
774 <p class='example'
><a name=
"LISTING2">Listing
2:
"examples/grouping.drv"</a></p>
776 <pre class='example'
>
778 <I>// Include standard font and media definitions
</I>
779 <a href='ref-ppdcfile.html#_include'
>#include
</a> <font.defs
>
780 <a href='ref-ppdcfile.html#_include'
>#include
</a> <media.defs
>
782 <I>// List the fonts that are supported, in this case all standard fonts...
</I>
783 <a href='ref-ppdcfile.html#Font'
>Font
</a> *
785 <I>// Manufacturer and version
</I>
786 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "Foo"
787 <a href='ref-ppdcfile.html#Version'
>Version
</a> 1.0
789 <I>// Each filter provided by the driver...
</I>
790 <a href='ref-ppdcfile.html#Filter'
>Filter
</a> application/vnd.cups-raster
100 rastertofoo
792 <I>// Supported page sizes
</I>
793 *
<a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> Letter
794 <a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> A4
797 <I>// Supported resolutions
</I>
798 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "600dpi/600 DPI"
800 <I>// Specify the model name and filename...
</I>
801 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
802 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojet2k.ppd"
806 <I>// Supported resolutions
</I>
807 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "1200dpi/1200 DPI"
809 <I>// Specify the model name and filename...
</I>
810 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2001"
811 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojt2k1.ppd"
815 <P>The second example is essentially the same as the first, except that each
816 printer model is defined inside of a pair of curly braces. For example, the
817 first printer is defined using:
</P>
819 <pre class='example'
>
821 // Supported resolutions
822 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "600dpi/600 DPI"
824 // Specify the model name and filename...
825 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
826 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojet2k.ppd"
830 <P>The printer
<I>inherits
</I> all of the definitions from the parent group (the
831 top part of the file) and adds the additional definitions inside the curly
832 braces for that printer driver. When we define the second group, it also
833 inherits the same definitions from the parent group but
<I>none
</I> of the
834 definitions from the first driver. Groups can be nested to any number of levels
835 to support variations of similar models without duplication of information.
</P>
838 <h3><a name='COLOR'
>Color Support
</a></h3>
840 <P>For printer drivers that support color printing, the
841 <TT>ColorDevice
</TT> and
<TT>ColorModel
</TT> directives should be
842 used to tell the printing system that color output is desired
843 and in what formats.
<A HREF=
"#LISTING3">Listing
3</A> shows a
844 variation of the previous example which includes a color printer
845 that supports printing at
300 and
600 DPI.
</P>
847 <P>The key changes are the addition of the
<TT>ColorDevice
</TT>
850 <pre class='example'
>
851 <a href='ref-ppdcfile.html#ColorDevice'
>ColorDevice
</a> true
854 <P>which tells the printing system that the printer supports
855 color printing, and the
<TT>ColorModel
</TT> directives:
</P>
857 <pre class='example'
>
858 <a href='ref-ppdcfile.html#ColorModel'
>ColorModel
</a> Gray/Grayscale w chunky
0
859 *
<a href='ref-ppdcfile.html#ColorModel'
>ColorModel
</a> RGB/Color rgb chunky
0
862 <P>which tell the printing system which colorspaces are supported by the printer
863 driver for color printing. Each of the
<TT>ColorModel
</TT> directives is
864 followed by the option name and text (
<TT>Gray/Grayscale
</TT> and
865 <TT>RGB/Color
</TT>), the colorspace name (
<TT>w
</TT> and
<TT>rgb
</TT>), the
866 color organization (
<TT>chunky
</TT>), and the compression mode number
867 (
<TT>0</TT>) to be passed to the driver. The option name can be any of the
868 standard Adobe
<TT>ColorModel
</TT> names:
</P>
872 <LI><TT>Gray
</TT> - Grayscale output.
874 <LI><TT>RGB
</TT> - Color output, typically using the RGB
875 colorspace, but without a separate black channel.
877 <LI><TT>CMYK
</TT> - Color output with a separate black
882 <P>Custom names can be used, however it is recommended that you use your vendor
883 prefix for any custom names, for example
"fooName".
</P>
885 <P>The colorspace name can be any of the following universally supported
889 <LI><TT>w
</TT> - Luminance
</LI>
891 <LI><TT>rgb
</TT> - Red, green, blue
</LI>
893 <LI><TT>k
</TT> - Black
</LI>
895 <LI><TT>cmy
</TT> - Cyan, magenta, yellow
</LI>
897 <LI><TT>cmyk
</TT> - Cyan, magenta, yellow, black
</LI>
901 <P>The color organization can be any of the following values:
</P>
905 <LI><TT>chunky
</TT> - Color values are passed together on a line
906 as RGB RGB RGB RGB
</LI>
908 <LI><TT>banded
</TT> - Color values are passed separately
909 on a line as RRRR GGGG BBBB; not supported by the Apple
912 <LI><TT>planar
</TT> - Color values are passed separately
913 on a page as RRRR RRRR RRRR ... GGGG GGGG GGGG ... BBBB
914 BBBB BBBB; not supported by the Apple RIP filters
</LI>
918 <P>The compression mode value is passed to the driver in the
919 <TT>cupsCompression
</TT> attribute. It is traditionally used to select an
920 appropriate compression mode for the color model but can be used for any
921 purpose, such as specifying a photo mode vs. standard mode.
</P>
923 <p class='example'
><a name=
"LISTING3">Listing
3:
"examples/color.drv"</a></p>
925 <pre class='example'
>
927 <I>// Include standard font and media definitions
</I>
928 <a href='ref-ppdcfile.html#_include'
>#include
</a> <font.defs
>
929 <a href='ref-ppdcfile.html#_include'
>#include
</a> <media.defs
>
931 <I>// List the fonts that are supported, in this case all standard fonts...
</I>
932 <a href='ref-ppdcfile.html#Font'
>Font
</a> *
934 <I>// Manufacturer and version
</I>
935 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "Foo"
936 <a href='ref-ppdcfile.html#Version'
>Version
</a> 1.0
938 <I>// Each filter provided by the driver...
</I>
939 <a href='ref-ppdcfile.html#Filter'
>Filter
</a> application/vnd.cups-raster
100 rastertofoo
941 <I>// Supported page sizes
</I>
942 *
<a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> Letter
943 <a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> A4
946 <I>// Supported resolutions
</I>
947 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "600dpi/600 DPI"
949 <I>// Specify the model name and filename...
</I>
950 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
951 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojet2k.ppd"
955 <I>// Supports color printing
</I>
956 <a href='ref-ppdcfile.html#ColorDevice'
>ColorDevice
</a> true
958 <I>// Supported colorspaces
</I>
959 <a href='ref-ppdcfile.html#ColorModel'
>ColorModel
</a> Gray/Grayscale w chunky
0
960 *
<a href='ref-ppdcfile.html#ColorModel'
>ColorModel
</a> RGB/Color rgb chunky
0
962 <I>// Supported resolutions
</I>
963 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> -
8 0 0 0 "300dpi/300 DPI"
964 <a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> -
8 0 0 0 "600dpi/600 DPI"
966 <I>// Specify the model name and filename...
</I>
967 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet Color"
968 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojetco.ppd"
973 <h3><a name='OPTIONS'
>Defining Custom Options and Option Groups
</a></h3>
975 <P>The
<TT>Group
</TT>,
<TT>Option
</TT>, and
<TT>Choice
</TT>
976 directives are used to define or select a group, option, or
977 choice.
<A HREF=
"#LISTING4">Listing
4</A> shows a variation of
978 the first example that provides two custom options in a group
981 <p class='example'
><a name=
"LISTING4">Listing
4:
"examples/custom.drv"</a></p>
983 <pre class='example'
>
985 <I>// Include standard font and media definitions
</I>
986 <a href='ref-ppdcfile.html#_include'
>#include
</a> <font.defs
>
987 <a href='ref-ppdcfile.html#_include'
>#include
</a> <media.defs
>
989 <I>// List the fonts that are supported, in this case all standard fonts...
</I>
990 <a href='ref-ppdcfile.html#Font'
>Font
</a> *
992 <I>// Manufacturer, model name, and version
</I>
993 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "Foo"
994 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
995 <a href='ref-ppdcfile.html#Version'
>Version
</a> 1.0
997 <I>// Each filter provided by the driver...
</I>
998 <a href='ref-ppdcfile.html#Filter'
>Filter
</a> application/vnd.cups-raster
100 rastertofoo
1000 <I>// Supported page sizes
</I>
1001 *
<a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> Letter
1002 <a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> A4
1004 <I>// Supported resolutions
</I>
1005 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "600dpi/600 DPI"
1007 <I>// Option Group
</I>
1008 <a href='ref-ppdcfile.html#Group'
>Group
</a> "Footasm"
1010 <I>// Boolean option
</I>
1011 <a href='ref-ppdcfile.html#Option'
>Option
</a> "fooEnhance/Resolution Enhancement" Boolean AnySetup
10
1012 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> True/Yes
"<</cupsCompression 1>>setpagedevice"
1013 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> False/No
"<</cupsCompression 0>>setpagedevice"
1015 <I>// Multiple choice option
</I>
1016 <a href='ref-ppdcfile.html#Option'
>Option
</a> "fooOutputType/Output Quality" PickOne AnySetup
10
1017 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> "Auto/Automatic Selection"
1018 "<</OutputType(Auto)>>setpagedevice""
1019 <a href='ref-ppdcfile.html#Choice'>Choice</a> "Text/Optimize for Text
"
1020 "<</OutputType(Text)
>>setpagedevice
""
1021 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "Graph/Optimize for Graphics"
1022 "<</OutputType(Graph)>>setpagedevice""
1023 <a href='ref-ppdcfile.html#Choice'>Choice</a> "Photo/Optimize for Photos
"
1024 "<</OutputType(Photo)
>>setpagedevice
""
1026 <I>// Specify the name of the PPD file we want to generate...
</I>
1027 <a href='ref-ppdcfile.html#PCFileName'
>PCFileName
</a> "foojet2k.ppd"
1030 <P>The custom group is introduced by the
<TT>Group
</TT>
1031 directive which is followed by the name and optionally text for
1034 <pre class='example'
>
1035 <a href='ref-ppdcfile.html#Group'
>Group
</a> "Footasm/Footastic Options"
1038 <P>The group name must conform to the PPD specification and
1039 cannot exceed
40 characters in length. If you specify user text,
1040 it cannot exceed
80 characters in length. The groups
1041 <TT>General
</TT>,
<TT>Extra
</TT>, and
1042 <TT>InstallableOptions
</TT> are predefined by CUPS; the general
1043 and extra groups are filled by the UI options defined by the PPD
1044 specification. The
<TT>InstallableOptions
</TT> group is reserved
1045 for options that define whether accessories for the printer
1046 (duplexer unit, finisher, stapler, etc.) are installed.
</P>
1048 <P>Once the group is specified, the
<TT>Option
</TT> directive is
1049 used to introduce a new option:
</P>
1051 <pre class='example'
>
1052 <a href='ref-ppdcfile.html#Option'
>Option
</a> "fooEnhance/Resolution Enhancement" Boolean AnySetup
10
1055 <P>The directive is followed by the name of the option and any
1056 optional user text, the option type, the PostScript document group, and
1057 the sort order number. The option name must conform to the PPD specification
1058 and cannot exceed
40 characters in length. If you specify user text, it
1059 cannot exceed
80 characters in length.
</P>
1061 <P>The option type can be
<TT>Boolean
</TT> for true/false
1062 selections,
<TT>PickOne
</TT> for picking one of many choices, or
1063 <TT>PickMany
</TT> for picking zero or more choices. Boolean
1064 options can have at most two choices with the names
1065 <TT>False
</TT> and
<TT>True
</TT>. Pick options can have any
1066 number of choices, although for Windows compatibility reasons
1067 the number of choices should not exceed
255.
</P>
1069 <P>The PostScript document group is typically
<TT>AnySetup
</TT>,
1070 meaning that the option can be introduced at any point in the
1071 PostScript document. Other values include
<TT>PageSetup
</TT> to
1072 include the option before each page and
<TT>DocumentSetup
</TT>
1073 to include the option once at the beginning of the document.
</P>
1075 <P>The sort order number is used to sort the printer commands
1076 associated with each option choice within the PostScript
1077 document. This allows you to setup certain options before others
1078 as required by the printer. For most CUPS raster printer
1079 drivers, the value
<TT>10</TT> can be used for all options.
</P>
1081 <P>Once the option is specified, each option choice can be
1082 listed using the
<TT>Choice
</TT> directive:
</P>
1084 <pre class='example'
>
1085 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> True/Yes
"<</cupsCompression 1>>setpagedevice"
1086 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> False/No
"<</cupsCompression 0>>setpagedevice"
1089 <P>The directive is followed by the choice name and optionally
1090 user text, and the PostScript commands that should be inserted
1091 when printing a file to this printer. The option name must
1092 conform to the PPD specification and cannot exceed
40 characters
1093 in length. If you specify user text, it cannot exceed
80
1094 characters in length.
</P>
1096 <P>The PostScript commands are also interpreted by any RIP
1097 filters, so these commands typically must be present for all
1098 option choices. Most commands take the form:
</P>
1100 <pre class='example'
>
1101 <</name value
>>setpagedevice
1104 <P>where
<TT>name
</TT> is the name of the PostScript page device
1105 attribute and
<TT>value
</TT> is the numeric or string value for
1109 <h3><a name='DEFINE'
>Defining Constants
</a></h3>
1111 <P>Sometimes you will want to define constants for your drivers
1112 so that you can share values in different groups within the same
1113 driver information file, or to share values between different
1114 driver information files using the
<TT>#include
</TT> directive.
1115 The
<TT>#define
</TT> directive is used to define constants for
1116 use in your printer definitions:
</P>
1118 <pre class='example'
>
1119 <a href='ref-ppdcfile.html#_define'
>#define
</a> NAME value
1122 <P>The
<TT>NAME
</TT> is any sequence of letters, numbers, and
1123 the underscore. The
<TT>value
</TT> is a number or string; if the
1124 value contains spaces you must put double quotes around it, for
1127 <pre class='example'
>
1128 <a href='ref-ppdcfile.html#_define'
>#define
</a> FOO
"My String Value"
1131 <P>Constants can also be defined on the command-line using the
<tt>-D
</tt>
1134 <pre class='command'
>
1135 ppdc
-DNAME=
"value" filename.drv
1138 <P>Once defined, you use the notation
<TT>$NAME
</TT> to substitute the value of
1139 the constant in the file, for example:
</P>
1141 <pre class='example'
>
1142 <a href='ref-ppdcfile.html#_define'
>#define
</a> MANUFACTURER
"Foo"
1143 <a href='ref-ppdcfile.html#_define'
>#define
</a> FOO_600
0
1144 <a href='ref-ppdcfile.html#_define'
>#define
</a> FOO_1200
1
1147 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "$MANUFACTURER"
1148 <a href='ref-ppdcfile.html#ModelNumber'
>ModelNumber
</a> $FOO_600
1149 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
1154 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "$MANUFACTURER"
1155 <a href='ref-ppdcfile.html#ModelNumber'
>ModelNumber
</a> $FOO_1200
1156 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2001"
1161 <P>Numeric constants can be bitwise OR'd together by placing the constants
1162 inside parenthesis, for example:
</P>
1164 <pre class='example'
>
1165 <I>// ModelNumber capability bits
</I>
1166 <a href='ref-ppdcfile.html#_define'
>#define
</a> DUPLEX
1
1167 <a href='ref-ppdcfile.html#_define'
>#define
</a> COLOR
2
1172 <I>// Define a model number specifying the capabilities of the printer...
</I>
1173 <a href='ref-ppdcfile.html#ModelNumber'
>ModelNumber
</a> ($DUPLEX $COLOR)
1179 <h3><a name='CONDITIONAL'
>Conditional Statements
</a></h3>
1181 <p>The PPD compiler supports conditional compilation using the
<tt>#if
</tt>,
1182 <tt>#elif
</tt>,
<tt>#else
</tt>, and
<tt>#endif
</tt> directives. The
<tt>#if
</tt>
1183 and
<tt>#elif
</tt> directives are followed by a constant name or an expression.
1184 For example, to include a group of options when
"ADVANCED" is defined:
</p>
1186 <pre class='example'
>
1187 <a href='ref-ppdcfile.html#_if'
>#if
</a> ADVANCED
1188 <a href='ref-ppdcfile.html#Group'
>Group
</a> "Advanced/Advanced Options"
1189 <a href='ref-ppdcfile.html#Option'
>Option
</a> "fooCyanAdjust/Cyan Adjustment"
1190 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus10/+10%" ""
1191 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus5/+5%" ""
1192 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> "none/No Adjustment" ""
1193 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus5/-5%" ""
1194 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus10/-10%" ""
1195 <a href='ref-ppdcfile.html#Option'
>Option
</a> "fooMagentaAdjust/Magenta Adjustment"
1196 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus10/+10%" ""
1197 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus5/+5%" ""
1198 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> "none/No Adjustment" ""
1199 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus5/-5%" ""
1200 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus10/-10%" ""
1201 <a href='ref-ppdcfile.html#Option'
>Option
</a> "fooYellowAdjust/Yellow Adjustment"
1202 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus10/+10%" ""
1203 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus5/+5%" ""
1204 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> "none/No Adjustment" ""
1205 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus5/-5%" ""
1206 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus10/-10%" ""
1207 <a href='ref-ppdcfile.html#Option'
>Option
</a> "fooBlackAdjust/Black Adjustment"
1208 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus10/+10%" ""
1209 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "plus5/+5%" ""
1210 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> "none/No Adjustment" ""
1211 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus5/-5%" ""
1212 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "minus10/-10%" ""
1213 <a href='ref-ppdcfile.html#_endif'
>#endif
</a>
1217 <h3><a name='CONSTRAINTS'
>Defining Constraints
</a></h3>
1219 <P>Constraints are strings that are used to specify that one or more option
1220 choices are incompatible, for example two-sided printing on transparency media.
1221 Constraints are also used to prevent the use of uninstalled features such as the
1222 duplexer unit, additional media trays, and so forth.
</P>
1224 <P>The
<TT>UIConstraints
</TT> directive is used to specify a constraint that is
1225 placed in the PPD file. The directive is followed by a string using one of the
1226 following formats:
</P>
1228 <pre class='example'
>
1229 <a href='ref-ppdcfile.html#UIConstraints'
>UIConstraints
</a> "*Option1 *Option2"
1230 <a href='ref-ppdcfile.html#UIConstraints'
>UIConstraints
</a> "*Option1 Choice1 *Option2"
1231 <a href='ref-ppdcfile.html#UIConstraints'
>UIConstraints
</a> "*Option1 *Option2 Choice2"
1232 <a href='ref-ppdcfile.html#UIConstraints'
>UIConstraints
</a> "*Option1 Choice1 *Option2 Choice2"
1235 <P>Each option name is preceded by the asterisk (
<TT>*
</TT>). If no choice is
1236 given for an option, then all choices
<I>except
</I> <TT>False
</TT> and
1237 <TT>None
</TT> will conflict with the other option and choice(s). Since the PPD
1238 compiler automatically adds reciprocal constraints (option A conflicts with
1239 option B, so therefore option B conflicts with option A), you need only specify
1240 the constraint once.
</P>
1242 <p class='example'
><a name=
"LISTING5">Listing
5:
"examples/constraint.drv"</a></p>
1244 <pre class='example'
>
1246 <I>// Include standard font and media definitions
</I>
1247 <a href='ref-ppdcfile.html#_include'
>#include
</a> <font.defs
>
1248 <a href='ref-ppdcfile.html#_include'
>#include
</a> <media.defs
>
1250 <I>// List the fonts that are supported, in this case all standard fonts...
</I>
1251 <a href='ref-ppdcfile.html#Font'
>Font
</a> *
1253 <I>// Manufacturer, model name, and version
</I>
1254 <a href='ref-ppdcfile.html#Manufacturer'
>Manufacturer
</a> "Foo"
1255 <a href='ref-ppdcfile.html#ModelName'
>ModelName
</a> "FooJet 2000"
1256 <a href='ref-ppdcfile.html#Version'
>Version
</a> 1.0
1258 <I>// Each filter provided by the driver...
</I>
1259 <a href='ref-ppdcfile.html#Filter'
>Filter
</a> application/vnd.cups-raster
100 rastertofoo
1261 <I>// Supported page sizes
</I>
1262 *
<a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> Letter
1263 <a href='ref-ppdcfile.html#MediaSize'
>MediaSize
</a> A4
1265 <I>// Supported resolutions
</I>
1266 *
<a href='ref-ppdcfile.html#Resolution'
>Resolution
</a> k
8 0 0 0 "600dpi/600 DPI"
1268 <I>// Installable Option Group
</I>
1269 <a href='ref-ppdcfile.html#Group'
>Group
</a> "InstallableOptions/Options Installed"
1271 <I>// Duplexing unit option
</I>
1272 <a href='ref-ppdcfile.html#Option'
>Option
</a> "OptionDuplexer/Duplexing Unit" Boolean AnySetup
10
1273 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> True/Installed
""
1274 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> "False/Not Installed" ""
1276 <I>// General Option Group
</I>
1277 <a href='ref-ppdcfile.html#Group'
>Group
</a> General
1279 <I>// Duplexing option
</I>
1280 <a href='ref-ppdcfile.html#Option'
>Option
</a> "Duplex/Two-Sided Printing" PickOne AnySetup
10
1281 *
<a href='ref-ppdcfile.html#Choice'
>Choice
</a> "None/No" "<</Duplex false>>setpagedevice""
1282 <a href='ref-ppdcfile.html#Choice'>Choice</a> "DuplexNoTumble/Long Edge Binding
"
1283 "<</Duplex true/Tumble false
>>setpagedevice
""
1284 <a href='ref-ppdcfile.html#Choice'
>Choice
</a> "DuplexTumble/Short Edge Binding"
1285 "<</Duplex true/Tumble true>>setpagedevice""
1287 <I>// Only allow duplexing if the duplexer is installed</I>
1288 <a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Duplex *OptionDuplexer False
"
1290 <I>// Specify the name of the PPD file we want to generate...</I>
1291 <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "foojet2k.ppd
"
1294 <P><A HREF="#LISTING5
">Listing 5</A> shows a variation of the first example with
1295 an added <TT>Duplex</TT> option and installable option for the duplexer,
1296 <TT>OptionDuplex</TT>. A constraint is added at the end to specify that any
1297 choice of the <TT>Duplex</TT> option that is not <TT>None</TT> is incompatible
1298 with the "Duplexer Installed
" option set to "Not Installed
"
1299 (<TT>False</TT>):</P>
1301 <pre class='example'>
1302 <a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*Duplex *OptionDuplexer False
"
1305 <h4>Enhanced Constraints</h4>
1307 <p>CUPS 1.4 supports constraints between 2 or more options using the
1308 <TT>Attribute</TT> directive. <TT>cupsUIConstraints</TT> attributes define
1309 the constraints, while <TT>cupsUIResolver</TT> attributes define option changes
1310 to resolve constraints. For example, we can specify the previous duplex
1311 constraint with a resolver that turns off duplexing with the following two
1314 <pre class='example'>
1315 <a href='ref-ppdcfile.html#Attribute'>Attribute</a> cupsUIConstraints DuplexOff "*Duplex *OptionDuplexer False
"
1316 <a href='ref-ppdcfile.html#Attribute'>Attribute</a> cupsUIResolver DuplexOff "*Duplex None
"
1319 <h2 class='title'><a name='LOCALIZATION'>Localization</a></h2>
1321 <p>The PPD compiler provides localization of PPD files in different languages
1322 through <i>message catalog</i> files in the GNU gettext or Apple .strings
1323 formats. Each user text string and several key PPD attribute values such as
1324 <tt>LanguageVersion</tt> and <tt>LanguageEncoding</tt> are looked up in the
1325 corresponding message catalog and the translated text is substituted in the
1326 generated PPD files. One message catalog file can be used by multiple driver
1327 information files, and each file contains a single language translation.</p>
1329 <h3><a name='PPDPO'>The ppdpo Utility</a></h3>
1331 <p>While CUPS includes localizations of all standard media sizes and options in
1332 several languages, your driver information files may provide their own media
1333 sizes and options that need to be localized. CUPS provides a utility program to
1334 aid in the localization of drivers called <a
1335 href='man-ppdpo.html'><tt>ppdpo(1)</tt></a>. The <tt>ppdpo</tt> program creates
1336 or updates a message catalog file based upon one or more driver information
1337 files. New messages are added with the word "TRANSLATE
" added to the front of
1338 the translation string to make locating new strings for translation easier. The
1339 program accepts the message catalog filename and one or more driver information
1342 <p>For example, run the following command to create a new German message catalog
1343 called <var>de.po</var> for all of the driver information files in the current
1346 <pre class='command'>
1347 ppdpo -o de.po *.drv
1350 <p>If the file <var>de.po</var> already exists, <tt>ppdpo</tt> will update the
1351 contents of the file with any new messages that need to be translated. To create
1352 an Apple .strings file instead, specify the output filename with a .strings
1353 extension, for example:</p>
1355 <pre class='command'>
1356 ppdpo -o de.strings *.drv
1359 <h3><a name='PPDC_CATALOG'>Using Message Catalogs with the PPD Compiler</a></h3>
1361 <p>Once you have created a message catalog, use the <a
1362 href='ref-ppdcfile.html#_po'><tt>#po</tt></a> directive to declare it in each
1363 driver information file. For example, to declare the German message catalog for
1366 <pre class='example'>
1367 <a href='ref-ppdcfile.html#_po'>#po</a> de "de.po
" // German
1370 <p>In fact, you can use the <tt>#po</tt> directive as many times as needed:</p>
1372 <pre class='example'>
1373 <a href='ref-ppdcfile.html#_po'>#po</a> de "de.po
" // German
1374 <a href='ref-ppdcfile.html#_po'>#po</a> es "es.po
" // Spanish
1375 <a href='ref-ppdcfile.html#_po'>#po</a> fr "fr.po
" // French
1376 <a href='ref-ppdcfile.html#_po'>#po</a> it "it.po
" // Italian
1377 <a href='ref-ppdcfile.html#_po'>#po</a> ja "ja.po
" // Japanese
1380 <p>The filename ("de.po
", etc.) can be relative to the location of the driver
1381 information file or an absolute path. Once defined, the PPD compiler will
1382 automatically generate a globalized PPD for every language declared in your
1383 driver information file. To generate a single-language PPD file, simply use the
1384 <tt>-l</tt> option to list the corresponding locale, for example:</p>
1386 <pre class='command'>
1387 ppdc -l de -d ppd/de mydrivers.drv
1390 <p>to generate German PPD files.</p>