Software Developer's Manual Raster Command Reference TD-2020/2120N/2130N TD-2030A/2125N/2125NWB/2135N/2135NWB Version 1.
The Brother logo is a registered trademark of Brother Industries, Ltd. Brother is a registered trademark of Brother Industries, Ltd. © 2013 Brother Industries, Ltd. All rights reserved. Microsoft and Windows are registered trademarks of Microsoft Corporation in the United States and other countries. Each owner whose software title is mentioned in this document has a Software License Agreement specific to its proprietary programs.
IMPORTANT - PLEASE READ CAREFULLY Note This documentation (“Documentation”) provides information that will assist you in controlling your Printer TD-XXXX (where “XXXX” is the model name). You may use the Documentation only if you first agree to the following conditions. If you do not agree to the following conditions, you may not use the Documentation. Condition of Use You may use and reproduce the Documentation to the extent necessary for your own use of your Printer Model (“Purpose”).
Raster Command Reference Contents Introduction ······························································································ 1 About Raster Commands ············································································ 2 1. Printing Using Raster Commands ····························································· 3 2. Print Data ······························································································ 5 2.
Raster Command Reference Introduction This material provides the necessary information for directly controlling the Brother printer TD-XXXX (where “XXXX” is the model name). This information is provided assuming that the user has full understanding of the operating system being used and basic mastery of USB and networks in a developer's environment. Details concerning the USB interface are not described in this material.
Raster Command Reference About Raster Commands Using raster commands an TD-XXXX printer (where “XXXX” is the model name) can be used to print without using our printer driver. This operation is useful in the following situations. ⚫ When printing from an operating system other than Windows (Example: When printing from a Linux computer or mobile terminal) ⚫ When adding print functions to an existing system In addition, printing can be performed with advanced settings.
Raster Command Reference 1. Printing Using Raster Commands The printing procedure is described below. For detailed flow charts, refer to “5. Flow Charts”. For details on each command, refer to “4. Printing Command Details”. (1) Open the port Port (2) Send the status (Confirm the printer status.) At your side (プリンタの状態を確認) (3) Send the print data (5) Send the status (Confirm that printing is completed.) Computer, mobile terminal, etc. Your printer (4) Print (6) Close the port - 3 1.
Raster Command Reference (1) Open the USB/serial/network port Open the USB/serial/network port in the operating environment. The procedure for opening the USB/serial/network port is not described in this material. The network port can be used with the TD-2120N/2130N/2125N/2125NWB/2135N/2135NWB.
Raster Command Reference 2. Print Data 2.1 Print data overview The print data is constructed of the following: (1) initialization commands, (2) control codes, (3) raster data, and (4) print commands. If the print job consists of multiple pages, (2) through (4) are repeated. (1) Initialization commands Specified only once at the beginning of the job. Sequence Command Name Description/Example 1 Invalidate Sends a 200-byte invalidate command, and then resets the printer to the receiving state.
Raster Command Reference (3) Raster data Repeated for each page in the print job. Sequence Command Name Description/Example - Raster graphics transfer Sends a raster line that contains data with pixels set to “ON”. - Zero raster graphics Sends a raster line with all pixels set to “0”.(Valid only when TIFF is selected as the compression mode) 5Ah (Fixed) (4) Print commands Specified at the end of the page.
Raster Command Reference 2.2 Sample (analyzing the print data of the test page) The print data created by the printer driver is described here. As an example, we will check the print data created when the [Print Test Page] button in the printer Properties dialog box is clicked to print the test page. Since the print data differs depending on the print settings of the printer, refer to this procedure and try creating print data with various print settings.
Raster Command Reference Step 1: Change the port of the printer to “FILE:”. Open the Printers and Faxes folder, and then right-click the printer (in this case, RJ-4030) to display the Properties dialog box. In the Properties dialog box, click the [Ports] tab, select the “FILE:” check box, and then click the [Apply] button. [Ports] tab of the printer Properties dialog box Step 2: Print the item (in this case, the test page), and then specify the file name.
Raster Command Reference When the test page is printed with the printer, a dialog box appears so that the file name can be specified. (Refer to the illustration below.) After a file name is typed in and the [OK] button is clicked, the printer driver creates the print data and saves it in a file with the specified name. Dialog box for specifying the file name Step 3: Open the print data in the binary file editor. Open the saved file in the binary file editor.
Raster Command Reference 2.2.3 Explanation of print data for the test page The print data for the test page outputted in the previous section is described below. The following illustration shows the print data created in section “2.2.1 Preparation” opened in the binary file editor. Print data - 10 2.
Raster Command Reference Descriptions for the numbers in the print data on the previous page are provided in the following table. For details on each command, refer to “4. Printing Command Details”. No. Command Name Description 1 Invalidate A 200-byte invalidate command is sent. 2 Initialize The “initialize” command is sent. 3 Switch dynamic command mode The printer is switched to raster mode. Send this command before sending raster data to the printer.
Raster Command Reference 2.3 Page data details 2.3.1 Resolution TD-2020/2120N/2125N/2125NWB Resolution Height-to-Width Proportion Priority on print speed 203 dpi high, 203 dpi wide 1:1 Priority on print quality 203 dpi high, 203 dpi wide 1:1 TD-2030A/2130N/2135N/2135NWB Resolution Height-to-Width Proportion Priority on print speed 300 dpi high, 300 dpi wide 1:1 Priority on print quality 300 dpi high, 300 dpi wide 1:1 - 12 2.
Raster Command Reference 2.3.2 Page size (a) Continuous length tape 1 5 3 6 Feeding direction 2 6 2 Print area 4 4 5 1 3 Print area Feeding direction Landscape Number Portrait 1 Width 2 Length 3 Print area width (maximum printing width) 4 Print area length 5 Width offset 6 Length offset 203dpi×203dpi ID Tape Size Designation 1 2 3 4 5 6 438 57 mm 57 mm 2.25" 57.2 mm 457 dots --> 2.3.4. 54.1 mm 432 dots -->2.3.4. 1.5 mm 12 dots --> 2.3.3. 426 58 mm 58 mm 2.28” 58.
Raster Command Reference (b) Die-cut labels 1 5 3 6 2 Number 4 Print area 1 Width 2 Length 3 Print area width (maximum printing width) 4 Print area length 5 Width offset 6 Length offset 203dpi×203dpi ID Label Size 1 2 3 4 5 6 422 RD 51 mm x 26 mm RD 2.0" x 1.0" 50.8 mm 406 dots 25.6 mm 205 dots 47.8 mm 382 dots 19.6 mm 157 dots 1.5 mm 12 dots 3.0 mm 24 dots 431 RD 30 mm x 30 mm RD 1.1" x 1.1" 30.0 mm 240 dots 30.0 mm 240 dots 27.0 mm 216 dots 24.0 mm 192 dots 1.
Raster Command Reference 300dpi×300dpi ID Label Size 1 2 3 4 5 6 422 RD 51 mm x 26 mm RD 2.0" x 1.0" 50.8 mm 600 dots 25.6 mm 302 dots 47.8 mm 564 dots 19.6 mm 231 dots 1.5 mm 18 dots 3.0 mm 35 dots 431 RD 30 mm x 30 mm RD 1.1" x 1.1" 30.0 mm 354 dots 30.0 mm 354 dots 26.9 mm 318 dots 24.0 mm 283 dots 1.5 mm 18 dots 3.0 mm 35 dots 432 RD 40 mm x 40 mm RD 1.5" x 1.5" 40.0 mm 472 dots 40.0 mm 472 dots 36.9 mm 436 dots 34.0 mm 401 dots 1.5 mm 18 dots 3.
Raster Command Reference 2.3.4 Maximum and minimum lengths The maximum and minimum lengths are defined below. 203dpi×203dpi Type Minimum Length Maximum Length Continuous length tape 12 mm 0.47” 96 dots 1000 mm 39.37” 7992 dots Die-cut labels Fixed Fixed 300dpi×300dpi Type Minimum Length Maximum Length Continuous length tape 12 mm 0.47” 142 dots 1000 mm 39.37” 11811 dots Die-cut labels Fixed Fixed - 16 2.
Raster Command Reference 2.3.5 Raster line As shown below, the parts with data to be printed are converted with “raster graphics transfer”, and the parts with no data are converted with “zero raster graphics”. On the actual tape, margins (feed) are added specified with “various mode settings” at the beginning and the end.
Raster Command Reference Total number of pins: TD-2020/2120N/2125N/2125NWB 448 pins / TD-2030A/2130N/2135N/2135NWB 672 pins Number of pins for right margin Raster line Left and right margins First byte Number of print area pins Total number of pins Print area Last byte 0 pin Number of pins for left margin Feeding direction Pins on print head Continuous length tape: TD-2020/2120N/2125N/2125NWB Tape Size Number of Pins for Left Margin Number of Print Area Pins Number of Pins for Right Margin Numb
Raster Command Reference Die-cut labels: TD-2020/2120N/2125N/2125NWB Label Size Number of Pins for Left Margin Number of Print Area Pins Number of Pins for Right Margin Number of Bytes for Raster Graphics Transfer 51 mm x 26 mm 33 382 33 56 30 mm x 30 mm 116 216 116 56 40 mm x 40 mm 76 296 76 56 40 mm x 50 mm 76 296 76 56 40 mm x 60 mm 76 296 76 56 50 mm x 30mm 36 376 36 56 60mm x 60mm 0 448 0 56 TD-2030A/2130N/2135N/2135NWB Label Size Number of Pins for Left Margin
Raster Command Reference 3.
Raster Command Reference 4. Printing Command Details NULL Invalidate ASCII: NULL Hexadecimal: 00 Description ⚫ Skipped ⚫ If data transmission is to be stopped midway, send the “initialize” command after sending the “invalidate” command for the appropriate number of bytes to return to the receiving state, where the print buffer is cleared. ESC @ ASCII: Initialize ESC Hexadecimal: 1B @ 40 Description ⚫ Initializes mode settings. ⚫ Also used to cancel printing.
Raster Command Reference Number Offset Size Name Value/Reference 1 0 1 Print head mark Fixed at 80h 2 1 1 Size Fixed at 20h 3 2 1 Reserved Fixed at “B” (42h) 4 3 1 Series code Fixed at “5” (35h) 5 4 1 Model code TD-2020: Fixed at “3” (33h) TD-2120N: Fixed at “5”(35h) TD-2130N: Fixed at “6” (36h) TD-2030A: Fixed at “D” (44h) TD-2125N: Fixed at “E” (45h) TD-2125NWB: Fixed at “F” (46h) TD-2135N: Fixed at “G” (47h) TD-2135NWB: Fixed at “H” (48h) 6 5 1 Reserved Fixed at “0” (30
Raster Command Reference (1) Error information 1 Flag Mask Definition Bit 0 01h “No media” error Bit 1 02h “End of media” error (only for die-cut labels) Bit 2 04h Bit 3 08h (Not used) Bit 4 10h Printer in use Bit 5 20h (Not used) Bit 6 40h (Not used) Bit 7 80h (Not used) (Not used) (2) Error information 2 Flag Mask Definition Bit 0 01h Bit 1 02h Bit 2 04h Bit 3 08h Bit 4 10h Bit 5 20h Bit 6 40h Media cannot be fed (also when the media end is detected) Bit 7 80
Raster Command Reference (3) Media width and length The media width and length is described in millimeters. 0~255 (0 to FFh) (a) Continuous length tape * Media Width: The tape width is indicated in millimeters. * Media Length: Fixed at 00h Media Media Width Media Length 57 mm 57 0 58 mm 58 0 (b) Die-cut labels * Media Width: The width of the die-cut section is indicated. * Media Length: The length of the die-cut section is indicated.
Raster Command Reference (5) Status type Status Type Value Reply to status request 00h Printing completed 01h Error occurred 02h Exit IF mode Description 03h (not used) Turned off 04h Notification 05h Phase change 06h (Not used) 08h to 20h (Reserved) 21h to FFh If an error occurred during printing, the printer returns the error status. (6) Phase type and phase number If the phase number is not used, both are fixed at 00h.
Raster Command Reference (7) Notification number Notification Value Not available 00h Cooling (started) 03h Cooling (finished) 04h Waiting for peeling 05h Finished waiting for peeling (Not used:Reserved) 06h Printer paused 07h Finished printer pause (Not used:Reserved) 08h (8) Battery level Battery Level Value Full 00h Half 01h Low 02h Charging required 03h AC adaptor in use 04h - 26 4.
Raster Command Reference ESC i a ASCII: Switch dynamic command mode ESC Hexadecimal: 1B i a {n1} 69 61 {n1} Parameters Definitions of {n}: 0: ESC/P mode (default) 1: Raster mode (Be sure to switch to this mode.) 3: P-touch Template mode Description ⚫ Dynamically switches between the printer's command modes. A printer that receives this command operates in the specified command mode until the printer is turned off. ⚫ The printer must be switched to raster mode before raster data is sent to it.
Raster Command Reference Open the [Devices and Printers] window, right-click the printer, and then display the Printing Preferences dialog box. Click the [Paper Size Setup] button on the [Basic] tab to display the Paper Size Setup dialog box. (Refer to the illustration below.) Click [Save Paper Size Commands] from the [Option] button to display a dialog box for creating a file for saving the paper size commands, and then save them in a file with the specified name. 2.
Raster Command Reference ESC i z Print information command ASCII: ESC Hexadecimal: 1B i z {n1} {n2} {n3} {n4} {n5} {n6} {n7} {n8} {n9} {n10} 69 7A {n1} {n2} {n3} {n4} {n5} {n6} {n7} {n8} {n9} {n10} Description ⚫ Specifies the print information.
Raster Command Reference ESC i M Various mode settings ASCII: ESC Hexadecimal: 1B i M {n1} 69 4D {n1} Parameters Definitions of {n1} The meaning of each bit in a 1-byte parameter is described below. 0 ~ 2bit:Not used 3bit:Inverted 180 Degrees 1. Rotates 180 degrees 0. Does not rotate 180 degrees 4bit:Peeler Function 1. Uses the peeler function 0.
Raster Command Reference M Select compression mode ASCII: M Hexadecimal: 4D {n} {n} Parameters Definitions of {n} 0 No-compression mode (Enabled) 1 Reserved (Disabled) 2 TIFF (Enabled) Normally TIFF compression with a serial connection Description ⚫ Selects the compression mode. Data compression is available only for data in raster graphic transfer. [TIFF(Pack Bits)] ⚫ 1-byte units ⚫ If the same data is repeated, the number of data units and that 1 byte of data are specified.
Raster Command Reference Explanation of “TIFF compression mode” With compression, the data for the “raster graphics transfer” command is based on 56 bytes (TD-2020/2120N/2125N/2125NWB) or 84 bytes (TD-2030A/2130N/2135N/2135NWB) of the total number of pins (TD-2020/2120N/2125N/2125NWB: 448 and TD-2030A/2130N/2135N/2135NWB: 672). As shown below, with no compression, the sum of the number of offset pins and the number of pins within the print area is the byte data.
Raster Command Reference g Raster graphics transfer ASCII: g Hexadecimal: 67 {s} {n} {d1} ... {dn} {s} {n} {d1} ... {dn} Parameters {s} 00h {n} Number of bytes of raster data (d1 to dh) However, use the following value if no compression is specified as the compression mode. TD-2020/2120N/2125N/2125NWB:n=56 TD-2030A/2130N/2135N/2135NWB:n=84 {d1~dn} Raster data. Z Zero raster graphics ASCII: Z Hexadecimal: 5A Description ⚫ Fills raster line with 0 data.
Raster Command Reference 5. Flow Charts Normally, printing is performed as buffered printing. However, if the printer is connected via USB and uncompressed data is received, concurrent printing is performed. Note: Concurrent printing:Printing starts immediately after the printer receives print data. Buffered printing:Printing starts after one page of print data is received. - 34 5.
Raster Command Reference 5.1 Concurrent printing normal flow for USB connection Printer Computer (host) Invalidate If there are no problems with the printer status (media, etc.), the data is READ transmitted. If there is a problem, an error appears. The printer is reset. Initialize The printer is initialized. Status information request Status (response to status information request) Displaying sending The status of the printer (media, etc.) is checked and a response is sent. Data received.
Raster Command Reference 5.2 Concurrent printing error flow for USB connection (when feeding at the end of the page) Computer (host) If there are no problems with the printer status (media, READ etc.), the data is transmitted. If there is a problem, an error appears. Displaying sending Printer Invalidate The printer is reset. Initialize The printer is initialized. Status information request Status (response to status information request) The status of the printer (media, etc.
Raster Command Reference 5.3 Concurrent printing error flow for USB connection (with a concurrent printing error such as end of tape) Computer (host) Invalidate If there are no problems with the printer status (media, etc.), the data is transmitted. If there is a problem, an error appears. Initialize Status information request READ Status (response to status information request) Displaying sending Printer Any jobs with errors remaining in the printer are cleared. The printer is initialized.
Raster Command Reference 5.4 Concurrent printing cooling flow for USB connection Computer (host) Printer Any jobs with errors remaining in the printer are cleared. Invalidate Initialize If there are no problems with the printer status (media, etc.), the READ data is transmitted. If there is a problem, an error appears. Displaying sending The printer is initialized. The status of the printer (media, etc.) is checked and a response is sent.
Raster Command Reference 5.5 Concurrent printing waiting for peeling/resumed flow for USB connection Printer Computer (host) Invalidate If there are no problems with the printer status (media, etc.), the data is READ transmitted. If there is a problem, an error appears. The printer is reset. Initialize The printer is initialized. Status information request Status (response to status information request) Displaying sending The status of the printer (media, etc.) is checked and a response is sent.
Raster Command Reference 5.6 Buffered printing normal flow for serial/USB connection Computer (host) If there are no problems with the printer status (media, READ etc.), the data is transmitted. If there is a problem, an error appears. Displaying sending Printer Invalidate The printer is reset. Initialize The printer is initialized. Status information request Status (response to status information request) Sending control codes The status of the printer (media, etc.
Raster Command Reference 5.7 Buffered printing error flow for serial/USB connection Computer (host) Printer Invalidate Initialize If there are no problems with the printer status READ (media, etc.), the data is transmitted. If there is a problem, an error appears. Displaying sending Status information request Status (response to status information request) or an error is displayed Sending control codes The printer is reset. The printer is Initialized. The status of the printer (media, etc.
Raster Command Reference 5.8 Buffered printing cooling flow for serial/USB connection Computer (host) Printer Invalidate Initialize If there are no problems with the printer status READ (media, etc.), the data is transmitted. If there is a problem, an error appears. Displaying sending The printer is reset. The printer is initialized. Status information request Status (response to status information request) Sending control codes Status (response to status request) Data received.
Raster Command Reference 5.9 Buffered printing waiting for peeling/resumed flow for serial/USB connection Computer (host) If there are no problems with the printer status (media, READ etc.), the data is transmitted. If there is a problem, an error appears. Displaying sending Printer Invalidate The printer is reset. Initialize The printer is initialized. Status information request Status (response to status information request) Sending control codes The status of the printer (media, etc.
Raster Command Reference 5.10 Buffered printing normal flow for network (standard TCP/IP port) connection ※With a network connection, print data from the operating system’s port monitor is sent as is. The following example is for printing 2 pages. Computer(host) The print data is divided into a specific size and sent.
Raster Command Reference Appendix A: USB Specifications USB specifications 1.
Raster Command Reference Appendix B: Introducing the Brother Developer Center Useful information for developers, such as applications, tools, SDKs as well as FAQs, are provided in the Brother Developer Center. https://support.brother.com/g/s/es/dev/en/index.