1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Adding a new printer</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="The Developer's Guide to Gutenprint"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Reporting Bugs"
HREF="c194.html"><LINK
REL="NEXT"
TITLE="The driver file"
HREF="x271.html"></HEAD
><BODY
CLASS="chapter"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Developer's Guide to Gutenprint</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="c194.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x271.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="chapter"
><H1
><A
NAME="AEN200"
></A
>Chapter 4. Adding a new printer</H1
><P
> This chapter covers adding a new ESCP/2, PCL, or Canon printer.
Writing a new driver module is not covered.
</P
><P
> The three steps to adding a printer are:
<P
></P
><OL
TYPE="1"
><LI
><P
> Add an entry to <TT
CLASS="filename"
>printers.xml</TT
>.
</P
></LI
><LI
><P
> Add the appropriate code and data to the appropriate
driver module.
</P
></LI
><LI
><P
> Tune the printer.
</P
></LI
></OL
>
</P
><P
> Printer information is stored in two places: in
<TT
CLASS="filename"
>printers.xml</TT
> (which contains the list of
printer models available to the the upper-level application),
and in the appropriate driver file
(<TT
CLASS="filename"
>print-escp2.c</TT
>,
<TT
CLASS="filename"
>print-pcl.c</TT
>, or
<TT
CLASS="filename"
>print-canon.c</TT
>).
</P
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="AEN217"
>4.1. <TT
CLASS="filename"
>printers.xml</TT
></A
></H1
><P
> <TT
CLASS="filename"
>printers.xml</TT
> is an XML file that contains
very simple printer definitions. A schema may be used to
validate the XML (<TT
CLASS="filename"
>src/main/gutenprint.xsd</TT
>).
This is an example definition:
</P
><DIV
CLASS="informalexample"
><P
></P
><A
NAME="AEN223"
></A
><PRE
CLASS="programlisting"
><printer name="EPSON Stylus Color 1500" driver="escp2-1500">
<color value="true"/>
<model value="2"/>
<gamma value="0.597"/>
<density value="1.0"/>
</printer></PRE
><P
></P
></DIV
><P
> There are other tags that may be present. The only ones that
are mandatory are <TT
CLASS="literal"
><printer></TT
>,
<TT
CLASS="literal"
><color></TT
> and
<TT
CLASS="literal"
><model></TT
>. The other optional parameters
(<TT
CLASS="literal"
><gamma></TT
> and
<TT
CLASS="literal"
><density></TT
> in this case) can be used to
adjust control settings. This is probably not the right place
for them; the printer drivers themselves should contain this
information. There's probably no good reason for anything but
gamma and density to be in here. Gamma refers to the printer's
gamma factor; density is the desired base ink density for the
printer. The Epson driver contains the density information for
each printer at each resolution internally. An even better
driver would adjust density and possibly even gamma for paper
type. All the more reason not to have that information here.
</P
><P
> If you really are curious about what tags are permitted, please
see the schema. These are the definitions of the tags that do
matter:
</P
><P
></P
><DIV
CLASS="variablelist"
><P
><B
>printdef XML elements</B
></P
><DL
><DT
><TT
CLASS="literal"
><family></TT
></DT
><DD
><P
> This defines what driver module this printer uses. The
attribute <TT
CLASS="literal"
>name</TT
> is the name of the
family driver to associate the printers with, for example
<TT
CLASS="literal"
>escp2</TT
>, <TT
CLASS="literal"
>pcl</TT
>,
<TT
CLASS="literal"
>canon</TT
>, <TT
CLASS="literal"
>ps</TT
> or
<TT
CLASS="literal"
>raw</TT
>. This tag may only contain
<TT
CLASS="literal"
><printer></TT
> elements.
</P
></DD
><DT
><TT
CLASS="literal"
><printer></TT
></DT
><DD
><P
> This starts the definition of a printer. It must contain
the attributes <TT
CLASS="literal"
>name</TT
> and
<TT
CLASS="literal"
>driver</TT
>. <TT
CLASS="literal"
>name</TT
> should
be is the full name of the printer, and must be human
readable. <TT
CLASS="literal"
>driver</TT
> should consist of
alphanumerics and hyphens, and be fairly short.
<TT
CLASS="literal"
>name</TT
> is what will appear in the
user-visible listing of printers, and may be translated
into the user's language, while <TT
CLASS="literal"
>driver</TT
>
is what is actually used to key into the list of printers.
It is legal to have multiple printers with the same driver
name.
</P
></DD
><DT
><TT
CLASS="literal"
><color></TT
></DT
><DD
><P
> This tag may not contain any content, but the
<TT
CLASS="literal"
>value</TT
> attribute may be set to
<TT
CLASS="literal"
>true</TT
> or <TT
CLASS="literal"
>false</TT
>. This
indicates that this printer is capable of color, or is not
capable of color respectively.
</P
></DD
><DT
><TT
CLASS="literal"
><model></TT
></DT
><DD
><P
> This defines a model number. This tag may not contain any
content, but the <TT
CLASS="literal"
>value</TT
> attribute may be
set to a positive integer. This is passed into the
driver, which may do whatever it cares to with
it—index into a table, compute on, or whatever.
This need not be unique.
</P
></DD
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="c194.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x271.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Reporting Bugs</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
> </TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>The driver file</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>
|