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