]> git.ipfire.org Git - thirdparty/cups.git/blame - doc/help/raster-driver.html
Merge changes from CUPS 1.4svn-r8162.
[thirdparty/cups.git] / doc / help / raster-driver.html
CommitLineData
e4572d57
MS
1<HTML>
2<!-- SECTION: Programming -->
3<HEAD>
4 <TITLE>Developing Raster Printer Drivers</TITLE>
5</HEAD>
6<BODY>
7
8<p>This document describes how to develop printer drivers for raster printers. Topics include: <a href='#BASICS'>printer driver basics</a>, <a href='#CREATE'>creating new PPD files</a>, <a href='#FILTERS'>using filters</a>, <a href='#COLOR'>implementing color management</a>, <a href='#MACOSX'>adding Mac OS X features</a>, and <a href='#DEPLOY'>deploying your driver</a>.</p>
9
10<div class='summary'><table summary='General Information'>
11<tbody>
12<tr>
13 <th>See Also</th>
14 <td>Programming: <a href='postscript-driver.html'>Developing PostScript Printer Drivers</a><br>
15 Programming: <a href='api-filter.html'>Filter and Backend Programming</a><br>
16 Programming: <a href='ppd-compiler.html'>Introduction to the PPD Compiler</a><br>
17 Programming: <a href='api-raster.html'>Raster API</a><br>
18 References: <a href='ref-ppdcfile.html'>PPD Compiler Driver Information File Reference</a><br>
19 Specifications: <a href='spec-ppd.html'>CUPS PPD Extensions</a></td>
20</tr>
21</tbody>
22</table></div>
23
24
25<h2 class='title'><a name='BASICS'>Printer Driver Basics</a></h2>
26
27<p>A CUPS raster printer driver consists of a PostScript Printer Description (PPD) file that describes the features and capabilities of the device, one or more <em>filter</em> programs that prepare print data for the device, and zero or more support files for color management, online help, and so forth. The PPD file includes references to all of the filters and support files used by the driver.</p>
28
29<p>Every time a user prints something the scheduler program, <a href='man-cupsd.html'>cupsd(8)</a>, determines the format of the print job and the programs required to convert that job into something the printer understands. CUPS includes filter programs for many common formats, for example to convert Portable Document Format (PDF) files into CUPS raster data. <a href='#FIGURE_1'>Figure 1</a> shows the data flow of a typical print job.</p>
30
31<div class='figure'><table summary='Raster Filter Chain'>
32<caption>Figure 1: <a name='FIGURE_1'>Raster Filter Chain</a></caption>
33<tr><td><img src='/images/cups-raster-chain.png' width='700' height='150' alt='Raster Filter Chain'></td></tr>
34</table></div>
35
36<p>The raster filter converts CUPS raster data into a format the printer understands, for example HP-PCL. CUPS includes several sample raster filters supporting standard page description languages (PDLs). <a href='#TABLE_1'>Table 1</a> shows the raster filters that are bundled with CUPS and the languages they support.</p>
37
38<div class='table'><table summary='Standard CUPS Raster Filters'>
39<caption>Table 1: <a name='TABLE_1'>Standard CUPS Raster Filters</a></caption>
40<thead>
41<tr><th>Filter</th><th>PDLs</th><th>ppdc DriverType</th><th>ppdc #include file</th></tr>
42</thead>
43<tbody>
44<tr><td>rastertoepson</td><td>ESC/P, ESC/P2</td><td>epson</td><td>epson.h</td></tr>
45<tr><td>rastertoescpx</td><td>ESC/P, ESC/P2, EPSON Remote Mode</td><td>escp</td><td>escp.h</td></tr>
46<tr><td>rastertohp</td><td>HP-PCL3, HP-PCL5</td><td>hp</td><td>hp.h</td></tr>
47<tr><td>rastertolabel</td><td>CPCL, Dymo, EPL1, EPL2, Intellitech PCL, ZPL</td><td>label</td><td>label.h</td></tr>
48<tr><td>rastertopclx</td><td>HP-RTL, HP-PCL3, HP-PCL3GUI, HP-PCL5, HP-PCL5c, HP-PCL5e</td><td>pcl</td><td>pcl.h</td></tr>
49</tbody>
50</table></div>
51
52<p>The optional port monitor handles interface-specific protocol or encoding issues. For example, some raster printers use the 1284.4 communications protocol.</p>
53
54<p>The backend handles communications with the printer, sending print data from the last filter to the printer and relaying back-channel data from the printer to the upstream filters. CUPS includes backend programs for common direct-connect interfaces and network protocols, and you can provide your own backend to support custom interfaces and protocols.</p>
55
56<p>The scheduler also supports a special "command" file format for sending maintenance commands and status queries to a printer or printer driver. Command print jobs typically use a single command filter program defined in the PPD file to generate the appropriate printer commands and handle any responses from the printer. <a href='#FIGURE_2'>Figure 2</a> shows the data flow of a typical command job.</p>
57
58<div class='figure'><table summary='Command Filter Chain'>
59<caption>Figure 2: <a name='FIGURE_2'>Command Filter Chain</a></caption>
60<tr><td><img src='/images/cups-command-chain.png' width='575' height='150' alt='Command Filter Chain'></td></tr>
61</table></div>
62
63<p>Raster printer drivers must provide their own command filter.</p>
64
65
66<h2 class='title'><a name='CREATING'>Creating New PPD Files</a></h2>
67
68<p>We recommend using the CUPS PPD compiler, <a href='man-ppdc.html'>ppdc(1)</a>, to create new PPD files since it manages many of the tedious (and error-prone!) details of paper sizes and localization for you. It also allows you to easily support multiple devices from a single source file. For more information see the "<a href='ppd-compiler.html'>Introduction to the PPD Compiler</a>" document. <a href='#LISTING_1'>Listing 1</a> shows a driver information file for several similar black-and-white HP-PCL5 laser printers.</p>
69
70<p class='example'>Listing 1: <a name='LISTING_1'>"examples/laserjet-basic.drv"</a></p>
71
72<pre class='example'>
73<I>// Include standard font and media definitions</I>
74<a href='ref-ppdcfile.html#_include'>#include</a> &lt;font.defs&gt;
75<a href='ref-ppdcfile.html#_include'>#include</a> &lt;media.defs&gt;
76
77<I>// Include HP-PCL driver definitions</I>
78<a href='ref-ppdcfile.html#_include'>#include</a> &lt;pcl.h&gt;
79
80<I>// Specify that this driver uses the HP-PCL driver...</I>
81<a href='ref-ppdcfile.html#DriverType'>DriverType</a> pcl
82
83<I>// Specify the driver options via the model number...</I>
84<a href='ref-ppdcfile.html#ModelNumber'>ModelNumber</a> ($PCL_PAPER_SIZE $PCL_PJL $PCL_PJL_RESOLUTION)
85
86<I>// List the fonts that are supported, in this case all standard fonts...</I>
87<a href='ref-ppdcfile.html#Font'>Font</a> *
88
89<I>// Manufacturer and driver version</I>
90<a href='ref-ppdcfile.html#Manufacturer'>Manufacturer</a> "HP"
91<a href='ref-ppdcfile.html#Version'>Version</a> 1.0
92
93<I>// Supported page sizes and their margins</I>
94<a href='ref-ppdcfile.html#HWMargins'>HWMargins</a> 18 12 18 12
95*<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Letter
96<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Legal
97<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Executive
98<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Monarch
99<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Statement
100<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> FanFoldGermanLegal
101
102<a href='ref-ppdcfile.html#HWMargins'>HWMargins</a> 18 12.72 18 12.72
103<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Env10
104
105<a href='ref-ppdcfile.html#HWMargins'>HWMargins</a> 9.72 12 9.72 12
106<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> A4
107<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> A5
108<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> B5
109<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> EnvC5
110<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> EnvDL
111<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> EnvISOB5
112<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> Postcard
113<a href='ref-ppdcfile.html#MediaSize'>MediaSize</a> DoublePostcard
114
115<I>// Only black-and-white output with mode 3 compression...</I>
116<a href='ref-ppdcfile.html#ColorModel'>ColorModel</a> Gray k chunky 3
117
118<I>// Supported resolutions</I>
119<a href='ref-ppdcfile.html#Resolution'>Resolution</a> - 1 0 0 0 "300dpi/300 DPI"
120*<a href='ref-ppdcfile.html#Resolution'>Resolution</a> - 8 0 0 0 "600dpi/600 DPI"
121
122<I>// Supported input slots</I>
123*<a href='ref-ppdcfile.html#InputSlot'>InputSlot</a> 7 "Auto/Automatic Selection"
124<a href='ref-ppdcfile.html#InputSlot'>InputSlot</a> 2 "Manual/Tray 1 - Manual Feed"
125<a href='ref-ppdcfile.html#InputSlot'>InputSlot</a> 4 "Upper/Tray 1"
126<a href='ref-ppdcfile.html#InputSlot'>InputSlot</a> 1 "Lower/Tray 2"
127<a href='ref-ppdcfile.html#InputSlot'>InputSlot</a> 5 "LargeCapacity/Tray 3"
128
129<I>// Tray 3 is an option...</I>
130<a href='ref-ppdcfile.html#Installable'>Installable</a> "OptionLargeCapacity/Tray 3 Installed"
131<a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*OptionLargeCapacity False *InputSlot LargeCapacity"
132
133{
134 <I>// HP LaserJet 2100 Series</I>
135 <a href='ref-ppdcfile.html#Throughput'>Throughput</a> 10
136 <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "LaserJet 2100 Series"
137 <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "hpljt211.ppd"
138}
139
140{
141 <I>// LaserJet 2200 and 2300 series have duplexer option...</I>
142 <a href='ref-ppdcfile.html#Duplex'>Duplex</a> normal
143 <a href='ref-ppdcfile.html#Installable'>Installable</a> "OptionDuplex/Duplexer Installed"
144 <a href='ref-ppdcfile.html#UIConstraints'>UIConstraints</a> "*OptionDuplex False *Duplex"
145
146 {
147 <I>// HP LaserJet 2200 Series</I>
148 <a href='ref-ppdcfile.html#Throughput'>Throughput</a> 19
149 <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "LaserJet 2200 Series"
150 <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "hpljt221.ppd"
151 }
152
153 {
154 <I>// HP LaserJet 2300 Series</I>
155 <a href='ref-ppdcfile.html#Throughput'>Throughput</a> 25
156 <a href='ref-ppdcfile.html#ModelName'>ModelName</a> "LaserJet 2300 Series"
157 <a href='ref-ppdcfile.html#PCFileName'>PCFileName</a> "hpljt231.ppd"
158 }
159}
160</pre>
161
162
163<h2 class='title'><a name='FILTERS'>Using Filters</a></h2>
164
165<p>The standard CUPS raster filters can be specified using the
166<a href='ref-ppdcfile.html#DriverType'><tt>DriverType</tt></a> directive, for example:</p>
167
168<pre class='example'>
169<I>// Specify that this driver uses the HP-PCL driver...</I>
170<a href='ref-ppdcfile.html#DriverType'>DriverType</a> pcl
171</pre>
172
173<p><a href='#TABLE_1'>Table 1</a> shows the driver types for each of the standard CUPS raster filters. For drivers that do not use the standard raster filters, the "custom" type is used with <a href='ref-ppdcfile.html#Filter'><tt>Filter</tt></a> directives:</p>
174
175<pre class='example'>
176<a href='ref-ppdcfile.html#DriverType'>DriverType</a> custom
177<a href='ref-ppdcfile.html#Filter'>Filter</a> application/vnd.cups-raster 100 /path/to/raster/filter
178<a href='ref-ppdcfile.html#Filter'>Filter</a> application/vnd.cups-command 100 /path/to/command/filter
179</pre>
180
181
182<h2 class='title'><a name='COLOR'>Implementing Color Management</a></h2>
183
184<p>Talk about ICC color profiles and sRGB as two best options.</p>
185
186
187<h2 class='title'><a name='MACOSX'>Adding Mac OS X Features</a></h2>
188
189<p>Talk about help books, icons, and PDEs.</p>
190
191
192<h2 class='title'><a name='DEPLOY'>Deploying Your Driver</a></h2>
193
194<p>Talk about install locations, etc.</p>
195
196
197</body>
198</html>