Debian Codegraph @

doc/developer/escp2.xml

raw symbols SCIP
1 <chapter>
2 <title>ESC/P2</title>
3 <para>
4 This is a description of the ESC/P2 raster commands used by the
5 Gutenprint printer driver, which is a subset of the complete
6 command set. Note that these are <emphasis>not</emphasis> always
7 correct, and are certainly not complete.
8 </para>
9 <para>
10 All ESCP/2 raster commands begin with the <literal>ESC</literal>
11 character (0x1b), followed by either one or two command characters
12 and arguments where applicable. Older commands generally have one
13 command character. Newer commands usually have a
14 &lsquo;<literal>(</literal>&rsquo; (left parenthesis) followed by
15 a command character and a byte count for the arguments that
16 follow. The byte count is a 16-bit (2 byte) binary integer, in
17 little endian order.
18 </para>
19 <para>
20 All arguments listed here are of the form
21 <literal>name[bytes]</literal> where <literal>[bytes]</literal> is
22 the number of bytes that comprise the argument. The arguments
23 themselves are usually one, two, or four byte integers, always
24 little endian (the least significant bits come first). Presumably
25 this is to match Intel processors.
26 </para>
27 <para>
28 In some cases, the same command sequence identifies different
29 versions of the same command, depending upon the number of bytes
30 of arguments.
31 </para>
32 <sect1>
33 <title>Standard commands</title>
34 <variablelist>
35 <title>ESC/P2 Commands</title>
36 <varlistentry>
37 <term><literal>ESC @</literal></term>
38 <listitem>
39 <para>
40 Reset the printer. Discards any output, ejects the
41 existing page, returns all settings to their default.
42 Always use this before printing a page.
43 </para>
44 </listitem>
45 </varlistentry>
46 <varlistentry>
47 <term><literal>ESC (G <varname>BC</varname>=1
48 <varname>ON1</varname></literal></term>
49 <listitem>
50 <para>
51 Turn on graphics mode. <varname>ON</varname> should be
52 <constant>1</constant> (turn on graphics mode).
53 </para>
54 </listitem>
55 </varlistentry>
56 <varlistentry>
57 <term><literal>ESC (U <varname>BC</varname>=1
58 <varname>UNIT1</varname></literal></term>
59 <listitem>
60 <para>
61 Set basic unit of measurement used by printer. This is
62 expressed in multiples of 1/3600". At 720 DPI,
63 <varname>UNIT</varname> is <constant>5</constant>; at
64 360 DPI, <varname>UNIT</varname> is
65 <constant>10</constant>.
66 </para>
67 </listitem>
68 </varlistentry>
69 <varlistentry>
70 <term><literal>ESC (U <varname>BC</varname>=5
71 <varname>PAGEUNITS1</varname> <varname>VUNIT1</varname>
72 <varname>HUNIT1</varname>
73 <varname>BASEUNIT2</varname></literal></term>
74 <listitem>
75 <para>
76 Set basic units of measurement used by the printer.
77 <varname>PAGEUNIT</varname> is the unit of page
78 measurement (for commands that set page dimensions and
79 the like). <varname>VUNIT</varname> is the unit of
80 vertical measurement (for vertical movement commands).
81 <varname>HUNIT</varname> is the unit of horizontal
82 movement (for horizontal positioning commands). All of
83 these units are expressed in
84 <varname>BASEUNIT</varname>, which is in reciprocal
85 inches. Typically, <varname>BASEUNIT</varname> is
86 <constant>1440</constant>. In 720 DPI mode,
87 <varname>PAGEUNIT</varname>, <varname>VUNIT</varname>,
88 and <varname>HUNIT</varname> are all
89 <constant>2</constant>; in 1440&times;720 DPI mode,
90 <varname>PAGEUNIT</varname> and <varname>VUNIT</varname>
91 are normally set to <constant>2</constant>;
92 <varname>HUNIT</varname> is set to
93 <constant>1</constant>.
94 </para>
95 </listitem>
96 </varlistentry>
97 <varlistentry>
98 <term><literal>ESC (K <varname>BC</varname>=2
99 <varname>ZERO1</varname>
100 <varname>GRAYMODE1</varname></literal></term>
101 <listitem>
102 <para>
103 Set color or grayscale mode, on printers supporting an
104 explicit grayscale mode. These printers can be
105 identified because they are advertised as having more
106 black nozzles than nozzles of individual colors.
107 Setting grayscale mode allows use of these extra nozzles
108 for faster printing. <varname>GRAYMODE</varname> should
109 be <constant>0</constant> or <constant>2</constant> for
110 color, <constant>1</constant> for grayscale.
111 <varname>ZERO</varname> should always be
112 <constant>0</constant>.
113 </para>
114 </listitem>
115 </varlistentry>
116 <varlistentry>
117 <term><literal>ESC (i <varname>BC</varname>=1
118 <varname>INTERLEAVE1</varname></literal></term>
119 <listitem>
120 <para>
121 If <varname>INTERLEAVE</varname> is
122 <constant>1</constant>, use printer interleave mode
123 (referred to by Epson as "MicroWeave". On older printers,
124 this is used to turn on printer interleave; on newer
125 printers, it prints one row at a time. All printers
126 support this mode. It should only be used at 720 (or
127 1440&times;720) DPI. The Epson Stylus Pro series
128 indicates additional modes (with additional optionss on
129 newer ones):
130 </para>
131 <variablelist>
132 <varlistentry>
133 <term><constant>2</constant></term>
134 <listitem>
135 <para>
136 &ldquo;Full-overlap&rdquo;
137 </para>
138 </listitem>
139 </varlistentry>
140 <varlistentry>
141 <term><constant>3</constant></term>
142 <listitem>
143 <para>
144 &ldquo;Four-pass&rdquo;
145 </para>
146 </listitem>
147 </varlistentry>
148 <varlistentry>
149 <term><constant>4</constant></term>
150 <listitem>
151 <para>
152 &ldquo;Full-overlap 2&rdquo;
153 </para>
154 </listitem>
155 </varlistentry>
156 </variablelist>
157 <para>
158 Any of these commands can be used with the high four
159 bits set to either <constant>3</constant> or
160 <constant>0</constant>.
161 </para>
162 </listitem>
163 </varlistentry>
164 <varlistentry>
165 <term><literal>ESC U
166 <varname>DIRECTION1</varname></literal></term>
167 <listitem>
168 <para>
169 If <varname>DIRECTION</varname> is
170 <constant>1</constant>, print unidirectionally; if
171 <constant>0</constant>, print bidirectionally.
172 </para>
173 </listitem>
174 </varlistentry>
175 <varlistentry>
176 <term><literal>ESC (s <varname>BC</varname>=1
177 <varname>SPEED1</varname></literal></term>
178 <listitem>
179 <para>
180 On some older printers, this controls the print head
181 speed. <varname>SPEED</varname> of
182 <constant>2</constant> is 10 inches/sec;
183 <varname>SPEED</varname> of <constant>0</constant> or 1
184 is 20.
185 </para>
186 </listitem>
187 </varlistentry>
188 <varlistentry>
189 <term><literal>ESC (e <varname>BC</varname>=2
190 <varname>ZERO1</varname>
191 <varname>DOTSIZE1</varname></literal></term>
192 <listitem>
193 <para>
194 Choose print dotsize. <varname>DOTSIZE</varname> can
195 take on various values, depending upon the printer.
196 Almost all printers support <constant>0</constant> and
197 <constant>2</constant>. Variable dot size printers
198 allow a value of <varname>16</varname>. Other than the
199 value of <varname>16</varname>, this appears to be
200 ignored at resolutions of 720 DPI and above.
201 </para>
202 </listitem>
203 </varlistentry>
204 <varlistentry>
205 <term><literal>ESC (C <varname>BC</varname>=2
206 <varname>PAGELENGTH2</varname></literal></term>
207 <term><literal>ESC (C <varname>BC</varname>=4
208 <varname>PAGELENGTH4</varname></literal></term>
209 <listitem>
210 <para>
211 Set the length of the page in &ldquo;pageunits&rdquo;
212 (see <literal>ESC (U</literal> above). The second form
213 of the command allows setting of longer page lengths on
214 new printers (these happen to be the printers that
215 support variable dot size).
216 </para>
217 </listitem>
218 </varlistentry>
219 <varlistentry>
220 <term><literal>ESC (c <varname>BC</varname>=4
221 <varname>TOP2</varname>
222 <varname>LENGTH2</varname></literal></term>
223 <term><literal>ESC (c <varname>BC</varname>=8
224 <varname>TOP4</varname>
225 <varname>LENGTH4</varname></literal></term>
226 <listitem>
227 <para>
228 Set the vertical page margins of the page in
229 &ldquo;pageunits&rdquo; (see <literal>ESC (U</literal>
230 above). The margins are specified as the top of the
231 page and the length of the page. The second form of the
232 command allows setting of longer page lengths on new
233 printers (these happen to be the printers that support
234 variable dot size).
235 </para>
236 </listitem>
237 </varlistentry>
238 <varlistentry>
239 <term><literal>ESC (S <varname>BC</varname>=8
240 <varname>WIDTH4</varname>
241 <varname>LENGTH4</varname></literal></term>
242 <listitem>
243 <para>
244 Set the width and length of the printed page region in
245 &ldquo;pageunits&rdquo; (see <literal>ESC (U</literal>
246 above).
247 </para>
248 </listitem>
249 </varlistentry>
250 <varlistentry>
251 <term><literal>ESC (v <varname>BC</varname>=2
252 <varname>ADVANCE2</varname></literal></term>
253 <term><literal>ESC (v <varname>BC</varname>=4
254 <varname>ADVANCE4</varname></literal></term>
255 <listitem>
256 <para>
257 Feed vertically <varname>ADVANCE</varname>
258 &ldquo;vertical units&rdquo; (see <literal>ESC
259 (U</literal> above) from the current print head
260 position.
261 </para>
262 </listitem>
263 </varlistentry>
264 <varlistentry>
265 <term><literal>ESC (V <varname>BC</varname>=2
266 <varname>ADVANCE2</varname></literal></term>
267 <term><literal>ESC (V <varname>BC</varname>=4
268 <varname>ADVANCE4</varname></literal></term>
269 <listitem>
270 <para>
271 Feed vertically <varname>ADVANCE</varname>
272 &ldquo;vertical units&rdquo; (see <literal>ESC
273 (U</literal> above) from the top margin.
274 </para>
275 </listitem>
276 </varlistentry>
277 <varlistentry>
278 <term><literal>ESC ($ <varname>BC</varname>=4
279 <varname>OFFSET4</varname></literal></term>
280 <listitem>
281 <para>
282 Set horizontal position to <varname>OFFSET</varname>
283 from the left margin. This command operates on printers
284 of the 740 class and newer (all printers with variable
285 dot size).
286 </para>
287 </listitem>
288 </varlistentry>
289 <varlistentry>
290 <term><literal>ESC $
291 <varname>OFFSET2</varname></literal></term>
292 <listitem>
293 <para>
294 Set horizontal position to <varname>OFFSET</varname>
295 from the left margin. This command operates on printers
296 of the 740 class and newer (all printers with variable
297 dot size).
298 </para>
299 </listitem>
300 </varlistentry>
301 <varlistentry>
302 <term><literal>ESC (\ <varname>BC</varname>=4
303 <varname>UNITS2</varname>
304 <varname>OFFSET2</varname></literal></term>
305 <listitem>
306 <para>
307 Set horizontal position to <varname>OFFSET</varname>
308 from the previous print head position, measured in
309 <varname>UNITS</varname>. <varname>UNITS</varname> is
310 measured in inverse inches, and should be set to 1440 in
311 all cases. This operates on all 1440 dpi printers that
312 do not support variable dot size.
313 </para>
314 </listitem>
315 </varlistentry>
316 <varlistentry>
317 <term><literal>ESC (/ <varname>BC</varname>=4
318 <varname>OFFSET4</varname></literal></term>
319 <listitem>
320 <para>
321 Set horizontal position to <varname>OFFSET</varname>
322 from the previous print head position, measured in
323 &ldquo;horizontal units&rdquo; (see <literal>ESC
324 (U</literal> above). This operates on all variable dot
325 size printers.
326 </para>
327 </listitem>
328 </varlistentry>
329 <varlistentry>
330 <term><literal>ESC \
331 <varname>OFFSET2</varname></literal></term>
332 <listitem>
333 <para>
334 Set horizontal position to <varname>OFFSET</varname>
335 from the previous print head position, measured in basic
336 unit of measurement (see <literal>ESC (U</literal>
337 above). This is used on all 720 dpi printers, and can
338 also be used on 1440 dpi printers in lower resolutions
339 to save a few bytes. Note that
340 <varname>OFFSET</varname> may be negative. The range of
341 values for this command is between
342 <constant>-16384</constant> and
343 <constant>16383</constant>.
344 </para>
345 </listitem>
346 </varlistentry>
347 <varlistentry>
348 <term><literal>ESC r
349 <varname>COLOR1</varname></literal></term>
350 <term><literal>ESC (r <varname>BC</varname>=2
351 <varname>DENSITY1</varname>
352 <varname>COLOR1</varname></literal></term>
353 <listitem>
354 <para>
355 Set the ink color. The first form is used on four-color
356 printers; the second on six-color printers.
357 <varname>DENSITY</varname> is <constant>0</constant> for
358 dark inks, <constant>1</constant> for light.
359 <varname>COLOR</varname> is
360 </para>
361 <table>
362 <title>Colors</title>
363 <tgroup cols="2" align="left">
364 <colspec colnum="1" colname="id"/>
365 <colspec colnum="2" colname="color"/>
366 <thead>
367 <row>
368 <entry><varname>COLOR</varname></entry>
369 <entry>Color name</entry>
370 </row>
371 </thead>
372 <tbody>
373 <row>
374 <entry><constant>0</constant></entry>
375 <entry>Black</entry>
376 </row>
377 <row>
378 <entry><constant>1</constant></entry>
379 <entry>Magenta</entry>
380 </row>
381 <row>
382 <entry><constant>2</constant></entry>
383 <entry>Cyan</entry>
384 </row>
385 <row>
386 <entry><constant>4</constant></entry>
387 <entry>Yellow</entry>
388 </row>
389 </tbody>
390 </tgroup>
391 </table>
392 <para>
393 This command is not used on variable dot size printers
394 in softweave mode.
395 </para>
396 </listitem>
397 </varlistentry>
398 <varlistentry>
399 <term><literal>ESC . <varname>COMPRESS1</varname>
400 <varname>VSEP1</varname> <varname>HSEP1</varname>
401 <varname>LINES1</varname> <varname>WIDTH2</varname>
402 data...</literal></term>
403 <listitem>
404 <para>
405 Print data. <varname>COMPRESS</varname> signifies the
406 compression mode.
407 </para>
408 <table>
409 <title>Compression modes</title>
410 <tgroup cols="2" align="left">
411 <colspec colnum="1" colname="id"/>
412 <colspec colnum="2" colname="compression"/>
413 <thead>
414 <row>
415 <entry><varname>COMPRESS</varname></entry>
416 <entry>Compression mode</entry>
417 </row>
418 </thead>
419 <tbody>
420 <row>
421 <entry><constant>0</constant></entry>
422 <entry>No compression</entry>
423 </row>
424 <row>
425 <entry><constant>1</constant></entry>
426 <entry>
427 TIFF compression (incorrectly documented as
428 &ldquo;run length encoded&rdquo;)
429 </entry>
430 </row>
431 <row>
432 <entry><constant>2</constant></entry>
433 <entry>
434 TIFF compression with a special command set.
435 </entry>
436 </row>
437 </tbody>
438 </tgroup>
439 </table>
440 <para>
441 <varname>VSEP</varname> depends upon resolution and
442 printer type. At 360 DPI, it is always
443 <constant>10</constant>. At 720 DPI, it is normally
444 <constant>5</constant>5. On the ESC 600, it is
445 <constant>40</constant> (8 &times; 5}). On some other
446 printers, it varies.
447 </para>
448 <para>
449 <varname>HSEP1</varname> is <constant>10</constant> at
450 360 DPI and <constant>5</constant> at 720 or 1440 DPI
451 (1440 DPI cannot be printed in one pass; it is printed
452 in two passes, with the dots separated in each pass by
453 1/720").
454 </para>
455 <para>
456 <varname>LINES</varname> is the number of lines to be
457 printed. It should be <constant>1</constant> in printer
458 interleave and 360 DPI. At 720 DPI softweave, it should
459 be the number of lines to be actually printed.
460 </para>
461 <para>
462 <varname>WIDTH</varname> is the number of pixels to be
463 printed in each row. Following this command, a carriage
464 return (<constant>13</constant> decimal,
465 <literal>0A</literal> hex) should be output to return
466 the print head position to the left margin.
467 </para>
468 <para>
469 The basic data format is a string of bytes, with data
470 from left to right on the page. Within each byte, the
471 highest bit is first.
472 </para>
473 <para>
474 The TIFF compression is implemented as one count byte
475 followed by one or more data bytes. There are two
476 cases:
477 </para>
478 <orderedlist>
479 <listitem>
480 <para>
481 If the count byte is <constant>128</constant> or
482 less, it is followed by ([count] + 1) data bytes.
483 So if the count byte is <constant>0</constant>, it
484 is followed by 1 data byte; if it is
485 <constant>128</constant>, it is followed by 129 data
486 bytes.
487 </para>
488 </listitem>
489 <listitem>
490 <para>
491 If the count byte is greater than 128, it is
492 followed by one byte. This byte is repeated (257 -
493 [count]) times. So if [count] is 129, the next byte
494 is treated as though it were repeated 128 times; if
495 [count] is 255, it is treated as though it were
496 repeated twice.
497 </para>
498 </listitem>
499 </orderedlist>
500 </listitem>
501 </varlistentry>
502 <varlistentry>
503 <term><literal>ESC i <varname>COLOR1</varname>
504 <varname>COMPRESS1</varname> <varname>BITS1</varname>
505 <varname>BYTES2</varname> <varname>LINES2</varname>
506 data...</literal></term>
507 <listitem>
508 <para>
509 Print data in the newer printers (that support variable
510 dot size), and Stylus Pro models.
511 <varname>COLOR</varname> is the color.
512 </para>
513 <table>
514 <title>Extended Colors</title>
515 <tgroup cols="2" align="left">
516 <colspec colnum="1" colname="id"/>
517 <colspec colnum="2" colname="color"/>
518 <thead>
519 <row>
520 <entry><varname>COLOR</varname></entry>
521 <entry>Color name</entry>
522 </row>
523 </thead>
524 <tbody>
525 <row>
526 <entry><constant>0</constant></entry>
527 <entry>Black</entry>
528 </row>
529 <row>
530 <entry><constant>1</constant></entry>
531 <entry>Magenta</entry>
532 </row>
533 <row>
534 <entry><constant>2</constant></entry>
535 <entry>Cyan</entry>
536 </row>
537 <row>
538 <entry><constant>4</constant></entry>
539 <entry>Yellow</entry>
540 </row>
541 <row>
542 <entry><constant>5</constant></entry>
543 <entry>Alternate black (Stylus C70/C80)</entry>
544 </row>
545 <row>
546 <entry><constant>6</constant></entry>
547 <entry>Alternate black (Stylus C70/C80)</entry>
548 </row>
549 <row>
550 <entry><constant>16</constant></entry>
551 <entry>Gray (&ldquo;light black&rdquo;)</entry>
552 </row>
553 <row>
554 <entry><constant>17</constant></entry>
555 <entry>Light magenta</entry>
556 </row>
557 <row>
558 <entry><constant>18</constant></entry>
559 <entry>Light cyan</entry>
560 </row>
561 </tbody>
562 </tgroup>
563 </table>
564 <para>
565 <varname>COMPRESS</varname> signifies the compression
566 mode:
567 </para>
568 <table>
569 <title>Compression modes</title>
570 <tgroup cols="2" align="left">
571 <colspec colnum="1" colname="id"/>
572 <colspec colnum="2" colname="compression"/>
573 <thead>
574 <row>
575 <entry><varname>COMPRESS</varname></entry>
576 <entry>Compression mode</entry>
577 </row>
578 </thead>
579 <tbody>
580 <row>
581 <entry><constant>0</constant></entry>
582 <entry>No compression</entry>
583 </row>
584 <row>
585 <entry><constant>1</constant></entry>
586 <entry>
587 TIFF compression (incorrectly documented as
588 &ldquo;run length encoded&rdquo;)
589 </entry>
590 </row>
591 <row>
592 <entry><constant>2</constant></entry>
593 <entry>
594 TIFF compression with a special command set, or
595 &ldquo;run length encoding 2&rdquo; on some
596 printers.
597 </entry>
598 </row>
599 </tbody>
600 </tgroup>
601 </table>
602 <para>
603 <varname>BITS</varname> is the number of bits per pixel.
604 </para>
605 <para>
606 <varname>BYTES</varname> is the number of bytes wide for
607 each row (ceiling(BITS &times; width_of_row, 8)}). Note
608 that this is different from the <literal>ESC .</literal>
609 command above.
610 </para>
611 <para>
612 <varname>LINES</varname> is the number of lines to be
613 printed. This command is the only way to get variable
614 dot size printing. In variable dot mode, the size of
615 the dots increases as the value (<constant>1</constant>,
616 <constant>2</constant>, or <constant>3</constant>)
617 increases.
618 </para>
619 </listitem>
620 </varlistentry>
621 <varlistentry>
622 <term><literal>ESC (D <varname>BC</varname>=4
623 <varname>BASE2</varname> <varname>VERTICAL1</varname>
624 <varname>HORIZONTAL1</varname></literal></term>
625 <listitem>
626 <para>
627 Set printer horizontal and vertical spacing. It only
628 applies to variable dot size printers in softweave mode
629 (and possibly other high end printers).
630 </para>
631 <para>
632 <varname>BASE</varname> is the base unit for this
633 command; it must be <constant>14400</constant>.
634 </para>
635 <para>
636 <varname>VERTICAL</varname> is the distance in these
637 units between printed rows; it should be
638 ((separation_in_nozzles &times; <varname>BASE</varname>
639 &divide; 720).
640 </para>
641 <para>
642 <varname>HORIZONTAL</varname> is the horizontal
643 separation between dots in a row. Depending upon the
644 printer, this should be either (14400 &divide; 720) or
645 (14400 &divide; 360). The Stylus Pro 9000 manual
646 suggests that the settings should match the chosen
647 resolution, but that is apparently not the case (or not
648 always the case) on other printers.
649 </para>
650 </listitem>
651 </varlistentry>
652 <varlistentry>
653 <term><literal>ESC (g <varname>BC</varname>=4
654 <varname>CUTPOS</varname></literal></term>
655 <listitem>
656 <para>
657 Only seen on roll-only printers like the SureLab D700, this
658 tells the printer where to actuate the cutter, eject the
659 page, and cease printing.
660 </para>
661 <para>
662 <varname>CUTPOS</varname> The row number at which to actuate
663 the cutter. It is resolution-indepenent, specified in
664 1/2880 in. units.
665 </para>
666 </listitem>
667 </varlistentry>
668 <varlistentry>
669 <term><literal>ESC (g <varname>BC</varname>=8 00 R E M O T E
670 1</literal></term>
671 <listitem>
672 <para>
673 Enters &ldquo;remote mode&rdquo;. This is a special,
674 undocumented command set that is used to set up various
675 printer options, such as paper feed tray, and perform
676 utility functions such as head cleaning and alignment.
677 It does not appear that anything here is actually
678 required to make the printer print. Our best
679 understanding of what is in a remote command sequence is
680 described in a separate section below.
681 </para>
682 </listitem>
683 </varlistentry>
684 <varlistentry>
685 <term><literal>ESC 01 @EJL [sp] ID\r\n</literal></term>
686 <listitem>
687 <para>
688 Return the printer ID. This is considered a remote mode
689 command, although the syntax is that of a conventional
690 command. This returns the following information:
691 </para>
692 <informalexample>
693 <screen>@EJL ID\r
694 MFG:EPSON;
695 CMD:ESCPL2,BDC;
696 MDL:[printer model];
697 CLS:PRINTER;
698 DES:EPSON [printer model];
699 \f</screen>
700 </informalexample>
701 <para>
702 After all data has been sent, a form feed byte should be
703 sent.
704 </para>
705 </listitem>
706 </varlistentry>
707 </variablelist>
708 <para>
709 All newer Epson printers (STC 440, STP 750) require the
710 following command to be sent at least once to enable printing
711 at all. This command specifically takes the printer out of the
712 1284.4 packet mode communication protocol and enables normal
713 data transfer. Sending it multiple times is is not harmful, so
714 it is normally sent at the beginning of each job:
715 </para>
716 <informalexample>
717 <screen>ESC 01@EJL[space]1284.4[newline]@EJL[space][space][space][space]
718 [space][newline]ESC@</screen>
719 </informalexample>
720 <para>
721 The proper sequence of initialization commands is:
722 </para>
723 <informalexample>
724 <screen>magic command
725 ESC @
726 remote mode if needed
727 ESC (G
728 ESC (U
729 ESC (K (if appropriate)
730 ESC (i
731 ESC U (if needed)
732 ESC (s (if appropriate)
733 ESC (e
734 ESC (C
735 ESC (c
736 ESC (S
737 ESC (D (if needed)
738 ESC (V (optional -- this can be accomplished with ESC (v)</screen>
739 </informalexample>
740 <para>
741 For printing, the proper sequence is:
742 </para>
743 <informalexample>
744 <screen>ESC (v</screen>
745 </informalexample>
746 <para>
747 and repeat for each color:
748 </para>
749 <!-- This needs better formatting... -->
750 <informalexample>
751 <screen>ESC ($ or ESC (\ or ESC \
752 ESC (r or ESC r (if needed---not used with "ESC i" and not needed if the color
753 has not changed from the previous printed line)
754 ESC . or ESC i ...data... [return] (0A hex)</screen>
755 </informalexample>
756 <para>
757 To terminate a page:
758 </para>
759 <informalexample>
760 <screen>[formfeed] (0C hex)
761 ESC @</screen>
762 </informalexample>
763 </sect1>
764 <sect1>
765 <title>Remote Mode Commands</title>
766 <para>
767 The following description of remote commands comes out of an
768 examination of the sequences used by the printer utilities
769 bundled with the Windows drivers for the ESC740, and from other
770 sources (some Epson manuals, experimentation, analysis of print
771 files). It is largely speculative as these commands are not all
772 documented in the Epson documentation we have access to.
773 Generally, newer manuals provide more thorough documentation.
774 </para>
775 <para>
776 Remote command mode is entered when the printer is sent the
777 following sequence:
778 </para>
779 <informalexample>
780 <screen>ESC (R BC=8 00 R E M O T E 1</screen>
781 </informalexample>
782 <para>
783 Remote mode commands are then sent, and terminated with the
784 following sequence:
785 </para>
786 <informalexample>
787 <screen>ESC 00 00 00</screen>
788 </informalexample>
789 <para>
790 All remote mode commands must be sent before the initial
791 <literal>ESC (G</literal> command is sent.
792 </para>
793 <para>
794 This introductory sequence is then followed by a sequence of
795 commands. Each command is constructed as follows:
796 </para>
797 <orderedlist>
798 <listitem>
799 <para>
800 Two ASCII bytes indicating the function
801 </para>
802 </listitem>
803 <listitem>
804 <para>
805 A byte count (two bytes, little-endian) for the parameters
806 </para>
807 </listitem>
808 <listitem>
809 <para>
810 Binary parameters, if any
811 </para>
812 </listitem>
813 </orderedlist>
814 <para>
815 This is a list of all remote commands we have seen:
816 </para>
817 <variablelist>
818 <title>ESC/P2 Remote Mode Commands</title>
819 <varlistentry>
820 <term><literal>NC <varname>BC</varname>=2 00
821 00</literal></term>
822 <listitem>
823 <para>
824 Print a nozzle check pattern.
825 </para>
826 </listitem>
827 </varlistentry>
828 <varlistentry>
829 <term><literal>VI <varname>BC</varname>=2 00
830 00</literal></term>
831 <listitem>
832 <para>
833 On my 740, prints the following, probably &ldquo;version
834 information&rdquo;:
835 </para>
836 <informalexample>
837 <screen>W01286 I02382\r\n</screen>
838 </informalexample>
839 </listitem>
840 </varlistentry>
841 <varlistentry>
842 <term><literal>* AI <varname>BC</varname>=3 00 00 00</literal></term>
843 <listitem>
844 <para>
845 Prints a &ldquo;printer ID&rdquo;. On one 870, prints the
846 following:
847 </para>
848 <informalexample>
849 <screen>51-51-50-51-49-48\r\n</screen>
850 </informalexample>
851 <para>
852 The Windows driver has a text entry field where this
853 number can be entered, but its purpose is unknown.
854 </para>
855 </listitem>
856 </varlistentry>
857 <varlistentry>
858 <term><literal>* LD <varname>BC</varname>=0</literal></term>
859 <listitem>
860 <para>
861 Load printer defaults from NVRAM, DIP switches, and/or
862 ROM. This apparently does not load factory defaults per
863 se, but any settings that are saved. This is commonly
864 used right at the end of each print job after the
865 <literal>ESC @</literal> printer reset command.
866 </para>
867 </listitem>
868 </varlistentry>
869 <varlistentry>
870 <term><literal>* CH <varname>BC</varname>=2 00
871 <varname>xx</varname></literal></term>
872 <listitem>
873 <para>
874 Perform a head cleaning cycle. The heads to clean are
875 determined by parameter <varname>xx</varname>:
876 </para>
877 <table>
878 <title>Head cleaning parameters</title>
879 <tgroup cols="2" align="left">
880 <colspec colnum="1" colname="id"/>
881 <colspec colnum="2" colname="description"/>
882 <thead>
883 <row>
884 <entry><varname>xx</varname></entry>
885 <entry>Description</entry>
886 </row>
887 </thead>
888 <tbody>
889 <row>
890 <entry><constant>00</constant></entry>
891 <entry>Clean all heads</entry>
892 </row>
893 <row>
894 <entry><constant>01</constant></entry>
895 <entry>Clean black head</entry>
896 </row>
897 <row>
898 <entry><constant>02</constant></entry>
899 <entry>Clean color heads</entry>
900 </row>
901 </tbody>
902 </tgroup>
903 </table>
904 <para>
905 While <varname>xx</varname> = <constant>00</constant> is
906 likely supported by all printers, <varname>xx</varname>
907 = <constant>01</constant> and <constant>02</constant>
908 are not.
909 </para>
910 </listitem>
911 </varlistentry>
912 <varlistentry>
913 <term><literal>* DT <varname>BC</varname>=3 00
914 <varname>xx</varname> 00</literal></term>
915 <listitem>
916 <para>
917 Print an alignment pattern. There are three patterns,
918 which are picked via the choice of
919 <varname>xx</varname>. Pattern <constant>0</constant>
920 is coarse, pattern <constant>1</constant> is medium, and
921 pattern <constant>2</constant> is fine.
922 </para>
923 </listitem>
924 </varlistentry>
925 <varlistentry>
926 <term><literal>* DA <varname>BC</varname>=4 00
927 <varname>xx</varname> 00
928 <varname>yy</varname></literal></term>
929 <listitem>
930 <para>
931 Set results for the alignment pattern.
932 <varname>xx</varname> is the pattern
933 (<constant>1</constant>--<constant>3</constant>);
934 <varname>yy</varname> is the best choice from the set
935 (<constant>1</constant>--<constant>7</constant> or
936 <constant>1</constant>--<constant>15</constant>). This
937 does not save to NVRAM, so when the printer is powered
938 off, the setting will be lost.
939 </para>
940 </listitem>
941 </varlistentry>
942 <varlistentry>
943 <term><literal>* SV <varname>BC</varname>=0</literal></term>
944 <listitem>
945 <para>
946 Save the current settings to NVRAM.
947 </para>
948 </listitem>
949 </varlistentry>
950 <varlistentry>
951 <term><literal>* RS <varname>BC</varname>=1
952 01</literal></term>
953 <listitem>
954 <para>
955 Reset the printer.
956 </para>
957 </listitem>
958 </varlistentry>
959 <varlistentry>
960 <term><literal>* IQ <varname>BC</varname>=1
961 01</literal></term>
962 <listitem>
963 <para>
964 Get ink quantity. This requires direct access to the
965 printer port. The return looks like
966 </para>
967 <informalexample>
968 <screen>IQ:KKCCMMYY</screen>
969 </informalexample>
970 <para>
971 or
972 </para>
973 <informalexample>
974 <screen>IQ:KKCCMMYYccmm</screen>
975 </informalexample>
976 <para>
977 (for 4-color and 6-color printers respectively), where
978 each pair of digits are hexadecimal representations of
979 percent.
980 </para>
981 </listitem>
982 </varlistentry>
983 </variablelist>
984 <para>
985 The following two commands have been observed on an STP 870.
986 </para>
987 <variablelist>
988 <varlistentry>
989 <term><literal>* IR <varname>BC</varname>=2 00
990 <varname>xx</varname></literal></term>
991 <listitem>
992 <para>
993 <emphasis>Function unknown</emphasis>. This command has
994 been observed on an STP 870 with
995 <varname>xx</varname>=<constant>03</constant> at the start
996 of a job and <varname>xx</varname>=<constant>02</constant>
997 at the end of a job (where it is followed by an
998 <literal>LD</literal> command). When in roll mode, the
999 values change to
1000 <varname>xx</varname>=<constant>01</constant> at the start
1001 of a job and <varname>xx</varname>=<constant>00</constant>
1002 at the end of a job.
1003 </para>
1004 </listitem>
1005 </varlistentry>
1006 <varlistentry>
1007 <term><literal>* FP <varname>BC</varname>=3 00
1008 <varname>pos</varname>[2]</literal></term>
1009 <listitem>
1010 <para>
1011 Specify the horizontal left margin in units of 1/360 inch.
1012 The default value for <varname>pos</varname> is
1013 <constant>0</constant>. For borderless printing on
1014 printers that support it, a value of
1015 <constant>-80</constant> (<constant>FFB0h</constant>)
1016 should be used.
1017 </para>
1018 </listitem>
1019 </varlistentry>
1020 </variablelist>
1021 <para>
1022 The commands below are partially documented in the Stylus Pro
1023 9000 manual. Much of this information is interpreted; none is
1024 tested.
1025 </para>
1026 <variablelist>
1027 <varlistentry>
1028 <term><literal>* SN <varname>BC</varname>=3 00
1029 <varname>xx</varname> <varname>yy</varname></literal></term>
1030 <listitem>
1031 <para>
1032 Select Mechanism Sequence. <varname>xx</varname>
1033 controls which sub-operation is performed.
1034 <varname>xx</varname>=<constant>00</constant> selects
1035 the &ldquo;Feed paper sequence setting&rdquo;.
1036 <varname>yy</varname> can take on the following values
1037 (on the STP 870, at any rate):
1038 </para>
1039 <table>
1040 <title>Media types</title>
1041 <tgroup cols="2" align="left">
1042 <colspec colnum="1" colname="id"/>
1043 <colspec colnum="2" colname="description"/>
1044 <thead>
1045 <row>
1046 <entry><varname>yy</varname></entry>
1047 <entry>Media type</entry>
1048 </row>
1049 </thead>
1050 <tbody>
1051 <row>
1052 <entry><constant>0</constant></entry>
1053 <entry>Default</entry>
1054 </row>
1055 <row>
1056 <entry><constant>1</constant></entry>
1057 <entry>Plain paper</entry>
1058 </row>
1059 <row>
1060 <entry><constant>2</constant></entry>
1061 <entry>Postcards</entry>
1062 </row>
1063 <row>
1064 <entry><constant>3</constant></entry>
1065 <entry>
1066 Film (photo quality glossy film, transparencies)
1067 </entry>
1068 </row>
1069 <row>
1070 <entry><constant>4</constant></entry>
1071 <entry>Envelopes</entry>
1072 </row>
1073 <row>
1074 <entry><constant>5</constant></entry>
1075 <entry>Plain paper (fast load)</entry>
1076 </row>
1077 <row>
1078 <entry><constant>6</constant></entry>
1079 <entry>
1080 Back light film (although this has been observed
1081 with heavyweight matte paper)
1082 </entry>
1083 </row>
1084 <row>
1085 <entry><constant>7</constant></entry>
1086 <entry>
1087 Matte paper (observed with 360 dpi inkjet paper,
1088 and photo quality inkjet paper)
1089 </entry>
1090 </row>
1091 <row>
1092 <entry><constant>8</constant></entry>
1093 <entry>Photo paper</entry>
1094 </row>
1095 </tbody>
1096 </tgroup>
1097 </table>
1098 <para>
1099 Experimentation suggests that this setting changes
1100 details of how the printers' cut sheet feeder works,
1101 presumably to tune it for different types of paper.
1102 </para>
1103 <para>
1104 <varname>xx</varname>=<constant>01</constant> controls
1105 the platen gap setting;
1106 <varname>yy</varname>=<constant>00</constant> is the
1107 default, <varname>yy</varname>=<constant>1</constant> or
1108 <constant>2</constant> are higher settings.
1109 </para>
1110 <para>
1111 <varname>xx</varname>=<constant>02</constant> controls
1112 paper loading speed
1113 (<varname>yy</varname>=<constant>0</constant> is normal,
1114 <constant>1</constant> is fast, <constant>2</constant>
1115 is slow). It appears that <constant>1</constant> is
1116 used when printing on &ldquo;plain paper&rdquo;,
1117 &ldquo;360dpi ink jet paper&rdquo; or &ldquo;ink jet
1118 transparencies&rdquo;, and
1119 <varname>yy</varname>=<constant>00</constant> for all
1120 other paper type settings.
1121 </para>
1122 <para>
1123 <varname>xx</varname>=<constant>07</constant> controls
1124 duplex printing for printers with that capability
1125 (<varname>yy</varname>=<varname>0</varname> is default,
1126 for non-duplex printing; <constant>1</constant> is front
1127 side of the paper, and <varname>2</varname> is back
1128 side).
1129 </para>
1130 <para>
1131 <varname>xx</varname>=<constant>09</constant> controls
1132 zero margin printing on the printers with the capability
1133 of printing zero-margin on all sides (Stylus Photo
1134 780/790, 890, and 1280/1290).
1135 <varname>yy</varname>=<constant>0</constant> is the
1136 default; <constant>1</constant> enables zero margin
1137 printing.
1138 </para>
1139 </listitem>
1140 </varlistentry>
1141 <varlistentry>
1142 <term><literal>* PP <varname>BC</varname>=3 00
1143 <varname>xx</varname>
1144 <varname>yy</varname></literal></term>
1145 <listitem>
1146 <para>
1147 Set Paper Path.
1148 <varname>xx</varname>=<constant>2</constant> indicates
1149 manual feed,
1150 <varname>xx</varname>=<constant>3</constant> is for roll
1151 paper. <varname>yy</varname> selects &ldquo;paper path
1152 number&rdquo;.
1153 </para>
1154 </listitem>
1155 </varlistentry>
1156 <varlistentry>
1157 <term><literal>* AC <varname>BC</varname>=2 00
1158 <varname>xx</varname></literal></term>
1159 <listitem>
1160 <para>
1161 Set Auto Cutting State.
1162 <varname>xx</varname>=<constant>0</constant> selects
1163 auto cutting off,
1164 <varname>xx</varname>=<constant>1</constant> selects
1165 auto cutting on, and
1166 <varname>xx</varname>=<constant>2</constant> indicates
1167 horizontal print page line on. It appears that with
1168 auto cutting on, roll paper is cut automatically at the
1169 point a formfeed character is sent. The formfeed
1170 character is normally used to eject a page; with this
1171 turned on, it also cuts the roll paper. Horizontal
1172 print page line on prints a narrow line of black dots at
1173 the position the paper should be cut manually.
1174 </para>
1175 </listitem>
1176 </varlistentry>
1177 <varlistentry>
1178 <term><literal>* DR <varname>BC</varname>=4 00 xx
1179 <varname>DT2</varname></literal></term>
1180 <listitem>
1181 <para>
1182 Set Drying Time.
1183 <varname>xx</varname>=<constant>00</constant> sets the
1184 drying time &ldquo;per scan&rdquo; (per pass?);
1185 <varname>xx</varname>=<constant>01</constant> sets the
1186 drying time per page. <varname>DT</varname> indicates
1187 the drying time, which is in seconds if page mode is
1188 used and in milliseconds if scan mode is used.
1189 <varname>DT</varname> must not exceed 3600 seconds in
1190 per-page mode and 10000 milliseconds in per-scan mode.
1191 </para>
1192 </listitem>
1193 </varlistentry>
1194 <varlistentry>
1195 <term><literal>* IK <varname>BC</varname>=2 00
1196 <varname>xx</varname></literal></term>
1197 <listitem>
1198 <para>
1199 Select Ink Type.
1200 <varname>xx</varname>=<constant>00</constant> selects
1201 dye ink. Pigment ink is apparently selected by
1202 <varname>xx</varname>=<constant>01</constant>. This
1203 probably does not apply to the consumer-grade printers.
1204 </para>
1205 </listitem>
1206 </varlistentry>
1207 <varlistentry>
1208 <term><literal>* PZ BC=2 00 xx</literal></term>
1209 <listitem>
1210 <para>
1211 Set Pause After Printing.
1212 <varname>xx</varname>=<constant>00</constant> selects no
1213 pause after printing;
1214 <varname>xx</varname>=<constant>01</constant> selects
1215 pause after printing. If turned on, the printer is
1216 paused after the page is ejected (by the FF byte). If
1217 cutting is turned on, the printer is paused
1218 <emphasis>after</emphasis> the cutting or printing of
1219 the horizontal cut line.
1220 </para>
1221 </listitem>
1222 </varlistentry>
1223 <varlistentry>
1224 <term><literal>* EX <varname>BC</varname>=6 00 00 00 00 0x14
1225 <varname>xx</varname></literal></term>
1226 <listitem>
1227 <para>
1228 Set Vertical Print Page Line Mode.
1229 <varname>xx</varname>=<constant>00</constant> is off,
1230 <varname>xx</varname>=<constant>01</constant> is on. If
1231 turned on, this prints vertical trim lines at the left
1232 and right margins.
1233 </para>
1234 </listitem>
1235 </varlistentry>
1236 <varlistentry>
1237 <term><literal>* EX <varname>BC</varname>=6 00 00 00 00 0x05
1238 <varname>xx</varname></literal></term>
1239 <listitem>
1240 <para>
1241 Set Roll Paper Mode. If <varname>xx</varname> is
1242 <constant>0</constant>, roll paper mode is off; if
1243 <varname>xx</varname> is <constant>1</constant>, roll
1244 paper mode is on.
1245 </para>
1246 </listitem>
1247 </varlistentry>
1248 <varlistentry>
1249 <term><literal>* EX <varname>BC</varname>=3 00
1250 <varname>xx</varname> <varname>yy</varname></literal></term>
1251 <listitem>
1252 <para>
1253 Appears to be a synonym for the <literal>SN</literal>
1254 command described above.
1255 </para>
1256 </listitem>
1257 </varlistentry>
1258 <varlistentry>
1259 <term><literal>* PH <varname>BC</varname>=2 00
1260 <varname>xx</varname></literal></term>
1261 <listitem>
1262 <para>
1263 Select Paper Thickness. Set the paper thickness
1264 <varname>xx</varname> in .1 mm units. This must not
1265 exceed <constant>0x10</constant> (1.6 mm). If the
1266 thickness is set &ldquo;more than&rdquo; .6 mm (which
1267 probably means &ldquo;at least&rdquo; 0.6 mm, since the
1268 other case reads &ldquo;less than 0.5 mm&rdquo;), the
1269 platen gap is set high irrespective of the
1270 <literal>SN</literal> command.
1271 </para>
1272 </listitem>
1273 </varlistentry>
1274 <varlistentry>
1275 <term><literal>* PM <varname>BC</varname>=2 00
1276 00</literal></term>
1277 <listitem>
1278 <para>
1279 <emphasis>Function unknown</emphasis>. Used on the STC
1280 3000 at least when using roll feed, and on the STP 870
1281 in all print files analysed to date.
1282 </para>
1283 </listitem>
1284 </varlistentry>
1285 <varlistentry>
1286 <term><literal>* ST <varname>BC</varname>=2 00
1287 <varname>xx</varname></literal></term>
1288 <listitem>
1289 <para>
1290 Epson's STP 750/1200 programming guide refers to the
1291 <literal>ST</literal> command as &ldquo;Set printer
1292 state reply&rdquo;. If <varname>xx</varname> is
1293 <constant>0</constant> or <constant>2</constant>, the
1294 printer will not send status replies. If
1295 <varname>xx</varname> is <constant>1</constant> or
1296 <constant>3</constant>, the printer will send status
1297 replies. The status replies consist of state, error
1298 codes, ink leve, firmware version, and warning status.
1299 </para>
1300 <para>
1301 The actual reply is documented as
1302 </para>
1303 <informalexample>
1304 <screen>@BDC ST\r
1305 ST: xx;
1306 [ER: yy;]
1307 IQ: n1n2n3n4;
1308 [WR: w1,w2...;]
1309 RV: zz;
1310 AI:CW:02kkccmmyy, MI:mm
1311 [TC:tttt;]
1312 INK:...;
1313 \f</screen>
1314 </informalexample>
1315 <para>
1316 (<literal>\r</literal> is carriage return;
1317 <literal>\n</literal> is newline; <literal>\f</literal>
1318 is formfeed.)
1319 </para>
1320 <para>
1321 <literal>ST</literal> is the printer status:
1322 </para>
1323 <table>
1324 <title>Printer status codes</title>
1325 <tgroup cols="2" align="left">
1326 <colspec colnum="1" colname="status"/>
1327 <colspec colnum="2" colname="description"/>
1328 <thead>
1329 <row>
1330 <entry>Status code</entry>
1331 <entry>Description</entry>
1332 </row>
1333 </thead>
1334 <tbody>
1335 <row>
1336 <entry><constant>00</constant></entry>
1337 <entry>Error</entry>
1338 </row>
1339 <row>
1340 <entry><constant>01</constant></entry>
1341 <entry>Self-test</entry>
1342 </row>
1343 <row>
1344 <entry><constant>02</constant></entry>
1345 <entry>Busy</entry>
1346 </row>
1347 <row>
1348 <entry><constant>03</constant></entry>
1349 <entry>Waiting while printing</entry>
1350 </row>
1351 <row>
1352 <entry><constant>04</constant></entry>
1353 <entry>Idle</entry>
1354 </row>
1355 <row>
1356 <entry><constant>07</constant></entry>
1357 <entry>Cleaning/filling ink heads</entry>
1358 </row>
1359 <row>
1360 <entry><constant>08</constant></entry>
1361 <entry>Not yet initialized/filling heads</entry>
1362 </row>
1363 </tbody>
1364 </tgroup>
1365 </table>
1366 <para>
1367 <literal>ER</literal>, if provided, is the error status:
1368 </para>
1369 <table>
1370 <title>Printer error codes</title>
1371 <tgroup cols="2" align="left">
1372 <colspec colnum="1" colname="error"/>
1373 <colspec colnum="2" colname="description"/>
1374 <thead>
1375 <row>
1376 <entry>Error code</entry>
1377 <entry>Description</entry>
1378 </row>
1379 </thead>
1380 <tbody>
1381 <row>
1382 <entry><constant>00</constant></entry>
1383 <entry>Fatal Error</entry>
1384 </row>
1385 <row>
1386 <entry><constant>01</constant></entry>
1387 <entry>Interface not selected</entry>
1388 </row>
1389 <row>
1390 <entry><constant>04</constant></entry>
1391 <entry>Paper jam</entry>
1392 </row>
1393 <row>
1394 <entry><constant>05</constant></entry>
1395 <entry>Out of ink</entry>
1396 </row>
1397 <row>
1398 <entry><constant>06</constant></entry>
1399 <entry>Paper out</entry>
1400 </row>
1401 <row>
1402 <entry><constant>0D</constant></entry>
1403 <entry>Paper gap error</entry>
1404 </row>
1405 <row>
1406 <entry><constant>10</constant></entry>
1407 <entry>Maintenance request</entry>
1408 </row>
1409 <row>
1410 <entry><constant>11</constant></entry>
1411 <entry>Tear-off mode selected</entry>
1412 </row>
1413 <row>
1414 <entry><constant>12</constant></entry>
1415 <entry>Double feed error</entry>
1416 </row>
1417 <row>
1418 <entry><constant>1C</constant></entry>
1419 <entry>Cutter position error</entry>
1420 </row>
1421 <row>
1422 <entry><constant>1D</constant></entry>
1423 <entry>Cutter jam</entry>
1424 </row>
1425 <row>
1426 <entry><constant>1E</constant></entry>
1427 <entry>Ink color error</entry>
1428 </row>
1429 <row>
1430 <entry><constant>23</constant></entry>
1431 <entry>Ink combination error</entry>
1432 </row>
1433 </tbody>
1434 </tgroup>
1435 </table>
1436 <para>
1437 <literal>IQ</literal> is the amount of ink left, as a
1438 (decimal!) percentage expressed in hexadecimal. The
1439 values are black, cyan, magenta, and yellow. 6 and 7
1440 color printers usually specify two or three additional
1441 values for light cyan, light magenta, and gray.
1442 However, some low end 6-color printers specify only four
1443 values.
1444 </para>
1445 <para>
1446 For printers with different ink cartridge options, the
1447 following additional values may appear:
1448 </para>
1449 <table>
1450 <title>Printer additional ink codes</title>
1451 <tgroup cols="2" align="left">
1452 <colspec colnum="1" colname="code"/>
1453 <colspec colnum="2" colname="description"/>
1454 <thead>
1455 <row>
1456 <entry>Ink code</entry>
1457 <entry>Description</entry>
1458 </row>
1459 </thead>
1460 <tbody>
1461 <row>
1462 <entry><constant>NA</constant></entry>
1463 <entry>Ink cartridge is not inserted</entry>
1464 </row>
1465 <row>
1466 <entry><constant>RE</constant></entry>
1467 <entry>
1468 Ink cartridge information cannot be read
1469 </entry>
1470 </row>
1471 <row>
1472 <entry><constant>WE</constant></entry>
1473 <entry>
1474 Ink cartridge information cannot be written
1475 </entry>
1476 </row>
1477 <row>
1478 <entry><constant>CI</constant></entry>
1479 <entry>
1480 Ink cartridge is inserted, but has not been read
1481 </entry>
1482 </row>
1483 </tbody>
1484 </tgroup>
1485 </table>
1486 <para>
1487 <literal>WR</literal>, if provided, is the warning status:
1488 </para>
1489 <table>
1490 <title>Printer warning codes</title>
1491 <tgroup cols="2" align="left">
1492 <colspec colnum="1" colname="warning"/>
1493 <colspec colnum="2" colname="description"/>
1494 <thead>
1495 <row>
1496 <entry>Warning code</entry>
1497 <entry>Description</entry>
1498 </row>
1499 </thead>
1500 <tbody>
1501 <row>
1502 <entry><constant>10</constant></entry>
1503 <entry>
1504 Black ink low (Photo black on printers using
1505 UltraChrome&reg; ink)
1506 </entry>
1507 </row>
1508 <row>
1509 <entry><constant>11</constant></entry>
1510 <entry>Cyan</entry>
1511 </row>
1512 <row>
1513 <entry><constant>12</constant></entry>
1514 <entry>Magenta</entry>
1515 </row>
1516 <row>
1517 <entry><constant>13</constant></entry>
1518 <entry>Yellow</entry>
1519 </row>
1520 <row>
1521 <entry><constant>14</constant></entry>
1522 <entry>Light cyan (presumably)</entry>
1523 </row>
1524 <row>
1525 <entry><constant>15</constant></entry>
1526 <entry>Light magenta (presumably)</entry>
1527 </row>
1528 <row>
1529 <entry><constant>17</constant></entry>
1530 <entry>
1531 Gray (with UltraChrome-compatible printers)
1532 </entry>
1533 </row>
1534 <row>
1535 <entry><constant>18</constant></entry>
1536 <entry>Matte black 1 (UltraChrome)</entry>
1537 </row>
1538 <row>
1539 <entry><constant>19</constant></entry>
1540 <entry>Matte black 2 (UltraChrome)</entry>
1541 </row>
1542 </tbody>
1543 </tgroup>
1544 </table>
1545 <para>
1546 <literal>RV</literal> is the firmware revision (one byte
1547 ASCII).
1548 </para>
1549 <para>
1550 <literal>AI</literal> is actuator information. These
1551 are two byte ASCII codes that indicate ``ink weight rank
1552 ID'' of KCMY, respectively.
1553 </para>
1554 <para>
1555 <literal>TC</literal>, if provided, is the total time of
1556 cleaning or ink filling (?).
1557 </para>
1558 <para>
1559 <literal>RC</literal>, if provided, is the firmware
1560 revision.
1561 </para>
1562 <para>
1563 <literal>INK:</literal> and <literal>MI</literal> are
1564 <emphasis>not documented</emphasis>.
1565 </para>
1566 </listitem>
1567 </varlistentry>
1568 <varlistentry>
1569 <term><literal>* SM <varname>BC</varname>=2 00
1570 <varname>xx</varname></literal></term>
1571 <listitem>
1572 <para>
1573 Set Status Reply Rate. <varname>xx</varname> is the
1574 repeat interval in seconds. If <varname>xx</varname> is
1575 <constant>0</constant>, the status is returned only when
1576 the printer's state changes.
1577 </para>
1578 </listitem>
1579 </varlistentry>
1580 <varlistentry>
1581 <term><literal>* ST <varname>BC</varname>=1
1582 01</literal></term>
1583 <listitem>
1584 <para>
1585 Reply Printer Status. The reply is formatted as follows:
1586 </para>
1587 <informalexample>
1588 <screen>@BDC PS\r\nST:<varname>xx</varname>;\f</screen>
1589 </informalexample>
1590 <para>
1591 <literal>\r</literal> is carriage return;
1592 <literal>\n</literal> is newline; <literal>\f</literal> is
1593 formfeed). If <varname>xx</varname> (the reply value) is
1594 <constant>0</constant> or <constant>2</constant>,
1595 automatic status update is disabled; if
1596 <constant>1</constant> or <constant>3</constant>, it is
1597 enabled.
1598 </para>
1599 </listitem>
1600 </varlistentry>
1601 <varlistentry>
1602 <term><literal>* SM <varname>BC</varname>=1
1603 01</literal></term>
1604 <listitem>
1605 <para>
1606 Reply Printer Status Rate. The reply is formatted as
1607 follows:
1608 </para>
1609 <informalexample>
1610 <screen>@BDC PS\r\nST:xx;\f</screen>
1611 </informalexample>
1612 <para>
1613 <literal>\r</literal> is carriage return;
1614 <literal>\n</literal> is newline; <literal>\f</literal> is
1615 formfeed). See <literal>SM
1616 <varname>BC</varname>=2</literal> above for the meaning of
1617 the return value.
1618 </para>
1619 </listitem>
1620 </varlistentry>
1621 <varlistentry>
1622 <term><literal>* ??
1623 <varname>BC</varname>=<varname>xx</varname>
1624 <varname>y</varname>[1] &hellip;
1625 <varname>y</varname>[xx]</literal></term>
1626 <listitem>
1627 <para>
1628 Echo Parameters (perhaps better described as Echo
1629 Commands). The command string is executed (it would
1630 appear from the documentation), and the string sent is
1631 returned using a sequence similar to that described in
1632 the <literal>ST <varname>BC</varname>=1</literal> and
1633 <literal>SM <varname>BC</varname>=1</literal> commands.
1634 Note that in this case the number of bytes is variable!
1635 </para>
1636 </listitem>
1637 </varlistentry>
1638 <varlistentry>
1639 <term><literal>* SM <varname>BC</varname>=2 00
1640 02</literal></term>
1641 <listitem>
1642 <para>
1643 <emphasis>Function unknown</emphasis>. Used on the STC
1644 3000 at least when using roll feed.
1645 </para>
1646 </listitem>
1647 </varlistentry>
1648 <varlistentry>
1649 <term><literal>* JE <varname>BC</varname>=1
1650 00</literal></term>
1651 <listitem>
1652 <para>
1653 <emphasis>Function unknown</emphasis>. On new printers
1654 (STC 740 or newer), this command should be sent after
1655 all data has been sent. If this command is not sent,
1656 and the printer is connected to a Windows system, the
1657 last page of the job will not print completely. The
1658 most likely explanation for for this is that the Windows
1659 driver typically puts the printer in 1284.4 packet mode,
1660 and this command has the effect of flushing the buffer
1661 in the printer.
1662 </para>
1663 </listitem>
1664 </varlistentry>
1665 <varlistentry>
1666 <term><literal>* CO <varname>BC</varname>=8 00
1667 <varname>cutter</varname>[1] <varname>page</varname>[1]
1668 <varname>unit</varname>[1]
1669 <varname>position</varname>[4]</literal></term>
1670 <listitem>
1671 <para>
1672 Specify paper cutting on Stylus Photo 2200 (and perhaps
1673 some other printers). <varname>cutter</varname> must be
1674 0. <varname>page</varname> should be one of the
1675 following:
1676 </para>
1677 <table>
1678 <title>Paper cutting codes</title>
1679 <tgroup cols="2" align="left">
1680 <colspec colnum="1" colname="code"/>
1681 <colspec colnum="2" colname="description"/>
1682 <thead>
1683 <row>
1684 <entry>Code</entry>
1685 <entry>Description</entry>
1686 </row>
1687 </thead>
1688 <tbody>
1689 <row>
1690 <entry><constant>0</constant></entry>
1691 <entry>All pages</entry>
1692 </row>
1693 <row>
1694 <entry><constant>1</constant></entry>
1695 <entry>First page only</entry>
1696 </row>
1697 <row>
1698 <entry><constant>2</constant></entry>
1699 <entry>Last page only</entry>
1700 </row>
1701 </tbody>
1702 </tgroup>
1703 </table>
1704 <para>
1705 <varname>unit</varname> should be one of the following:
1706 </para>
1707 <table>
1708 <title>Paper cutting units</title>
1709 <tgroup cols="2" align="left">
1710 <colspec colnum="1" colname="code"/>
1711 <colspec colnum="2" colname="description"/>
1712 <thead>
1713 <row>
1714 <entry>Code</entry>
1715 <entry>Description</entry>
1716 </row>
1717 </thead>
1718 <tbody>
1719 <row>
1720 <entry><constant>0</constant></entry>
1721 <entry>1/360 in.</entry>
1722 </row>
1723 <row>
1724 <entry><constant>1</constant></entry>
1725 <entry>1/720 in.</entry>
1726 </row>
1727 <row>
1728 <entry><constant>2</constant></entry>
1729 <entry>1/1440 in.</entry>
1730 </row>
1731 </tbody>
1732 </tgroup>
1733 </table>
1734 <para>
1735 This command should be used twice. The first
1736 <literal>CO</literal> command specifies where the page
1737 will be cut at the top, and the second specifies where
1738 the page will be cut at the bottom. This permits
1739 cutting both the top and the bottom of the page.
1740 </para>
1741 </listitem>
1742 </varlistentry>
1743 </variablelist>
1744 </sect1>
1745 <sect1>
1746 <title>Appropriate Remote Commands</title>
1747
1748 <para>
1749 All of the remote commands described above are wrapped up with
1750 the usual boilerplate. The files always start with
1751 <literal>00 00 00</literal> and the &ldquo;magic&rdquo;
1752 command described above, then two <literal>ESC @</literal>s to
1753 reset the printer. The remote command sequences come next; if
1754 they print anything that is usually followed by a
1755 <literal>FF</literal> (<literal>0C</literal> hex) character to
1756 feed the page, then the file ends with another two
1757 <literal>ESC @</literal>s to get back to the ground state.
1758 </para>
1759 <para>
1760 An alignment sequence goes like this:
1761 </para>
1762 <orderedlist>
1763 <listitem>
1764 <para>
1765 Host uses <literal>DT</literal> to print an alignment
1766 sheet.
1767 </para>
1768 </listitem>
1769 <listitem>
1770 <para>
1771 User eyeballs the sheet to see which is the best aligned
1772 pattern.
1773 </para>
1774 </listitem>
1775 <listitem>
1776 <para>
1777 Host sends a <literal>DA</literal> command indicating
1778 which pattern the user chose.
1779 </para>
1780 </listitem>
1781 <listitem>
1782 <para>
1783 If the user said &ldquo;realign&rdquo;, meaning he isn't
1784 done yet, go to step 1.
1785 </para>
1786 </listitem>
1787 <listitem>
1788 <para>
1789 We are done: host sends a <literal>SV</literal> command
1790 and exits.
1791 </para>
1792 </listitem>
1793 </orderedlist>
1794
1795 <para>
1796 The sequence used (by the STC 3000, at least) to print from
1797 the roll feed is (with byte count omitted):
1798 </para>
1799 <informalexample>
1800 <screen>PM 00 00
1801 SN 00 00 00
1802 EX 00 00 00 00 05 01
1803 ST 00 01
1804 SM 00 02</screen>
1805 </informalexample>
1806 <para>
1807 The sequence used by the STP 870 to print on plain paper is
1808 </para>
1809 <informalexample>
1810 <screen>PM 00 00
1811 IR 00 03
1812 SN 00 00 01
1813 SN 00 01 00
1814 SN 00 02 01
1815 EX 00 00 00 00 05 00
1816 FP 00 00 00</screen>
1817 </informalexample>
1818 <para>
1819 and the job finishes with
1820 </para>
1821 <informalexample>
1822 <screen>IR 00 02
1823 LD</screen>
1824 </informalexample>
1825 <para>
1826 For different paper type settings on the STP 870, the
1827 arguments to <literal>SN</literal> vary. The arguments to the
1828 first and third <literal>SN</literal> commands are as outlined
1829 in the description of the <literal>SN</literal> command above;
1830 the arguments to the second (&ldquo;platen gap&rdquo;) are
1831 <literal>00 01 01</literal> for thick papers (&ldquo;matte
1832 paper&mdash;heavyweight&rdquo;, &ldquo;photo paper&rdquo; and
1833 &ldquo;premium glossy photo paper&rdquo;) and <literal>00 01
1834 00</literal> for all others.
1835 </para>
1836 <para>
1837 For roll-mode printing, the STP 870's sequence changes as
1838 follows. <literal>IR</literal>'s arguments become <literal>00
1839 01</literal> in the header, and <literal>00 00</literal> after
1840 the job, and <literal>EX</literal>'s last argument changes
1841 from <constant>00</constant> to <constant>01</constant>.
1842 </para>
1843 <para>
1844 For zero-margin printing on the STP 870, the arguments to
1845 <literal>FP</literal> become <literal>00 0xb0 0xff</literal>.
1846 This moves the origin about 5.5mm to the left, to a point one
1847 tenth of an inch to the left of the left-hand edge of the
1848 paper, allowing printing right up to (and beyond) the edge of
1849 the paper. Some printers (at least the STP 870) include white
1850 absorbent pads at the left margin position and other positions
1851 (89mm and 100mm on the STP 870) to soak up ink which misses
1852 the edge of the paper. Printing off the edge of paper of a
1853 width not aligned with a pad could result in making a mess of
1854 the inside of the printer and ink getting on the reverse of
1855 the paper.
1856 </para>
1857 </sect1>
1858 </chapter>