Software Developer's Manual Raster Command Reference PT-P900/P900W/P950NW/P910BT Version 1.01
2020 Brother Industries, Ltd. All rights reserved. Microsoft and Windows are registered trademarks of Microsoft Corporation in the United States and other.
Software Developer's Manual Raster Command Reference PT-P900/P900W/P950NW/P910BT Version 1.01
Software Developer's Manual Raster Command Reference PT-P900/P900W/P950NW/P910BT Version 1.01 The Brother logo is a registered trademark of Brother Industries, Ltd. Brother is a registered trademark of Brother Industries, Ltd. © 2020 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. Any trade names and product names of companies appearing on Brother products, related documents and any other materials are all trademarks or registered trademarks of those respective companies. IMPORTANT - PLEASE READ CAREFULLY Note This documentation ("Documentation") provides information that will assist you in controlling your Printer PTXXXX (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"). Unless expressly permitted in the Documentation, you may not; (i) copy or reproduce the Documentation for any purpose other than the Purpose, (ii) modify, translate or adapt the Documentation, and/or redistribute it to any third party, (iii) rent or lease the Documentation to any third party, or, (iv) remove or alter any copyright notices or proprietary rights legends included within the Documentation. No Warranty a. Any updates, upgrades or alteration of the Documentation or Printer Model will be performed at the sole discretion of Brother. Brother may not respond to any request or inquiry about the Documentation. b. THIS DOCUMENTATION IS PROVIDED TO YOU "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. BROTHER DOES NOT REPRESENT OR WARRANT THAT THIS DOCUMENTATION IS FREE FROM ERRORS OR DEFECTS. c. IN NO EVENT SHALL BROTHER BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER, ARISING OUT OF THE USE, INABILITY TO USE, OR THE RESULTS OF USE OF THE DOCUMENTATION OR ANY SOFTWARE PROGRAM OR APPLICATION YOU DEVELOPED IN ACCORDANCE WITH THE DOCUMENTATION. Raster Command Reference Contents Introduction ······························································································1 About Raster Commands ············································································2 1. Printing Using Raster Commands ·····························································3 2. Print Data ······························································································5 2.1 Print data overview ························································································ 5 2.2 Sample (analyzing the print data of the test page) ················································ 7 2.2.1 Preparation ....................................................................................................... 7 2.2.2 Checking the print data...................................................................................... 7 2.2.3 Explanation of print data for the test page ........................................................ 10 2.3 Page data details ························································································· 12 2.3.1 Resolution ....................................................................................................... 12 2.3.2 Page size ........................................................................................................ 13 2.3.3 Feed amount ................................................................................................... 17 2.3.4 Maximum and minimum lengths ...................................................................... 18 2.3.5 Raster line....................................................................................................... 19 3. Print Command List ·············································································· 22 4. Printing Command Details ····································································· 23 NULL Invalidate ................................................................................................ 23 ESC @ Initialize .................................................................................................. 23 ESC i S Status information request ...................................................................... 23 ESC i a Switch dynamic command mode ............................................................. 32 ESC i z Print information command ..................................................................... 33 ESC i M Various mode settings............................................................................. 35 ESC i K Advanced mode settings ......................................................................... 36 ESC i d Specify margin amount (feed amount)..................................................... 37 ESC i A Specify the page number in "cut each * labels"........................................ 37 M Select compression mode ....................................................................... 38 G Raster graphics transfer.......................................................................... 40 Z Zero raster graphics................................................................................ 40 FF Print command ....................................................................................... 40 Control-Z Print command with feeding .................................................................... 41 ESC i ! Specify automatic status notification mode .............................................. 41 5. Flow Charts ························································································· 42 5.1 Concurrent printing normal flow for USB connection ············································ 43 5.2 Concurrent printing error flow for USB connection (when feeding at the end of the page)44 5.3 Concurrent printing error flow for USB connection (with a concurrent printing error such as end of tape)··································································································45 5.4 Buffered printing normal flow for USB/Bluetooth connection ·································· 46 5.5 Buffered printing error flow for USB/Bluetooth connection ····································· 47 5.6 Normal Flow for Network (Standard TCP/IP port) Connection ································ 48 Appendix A: USB Specifications ································································ 49 Appendix B: Introducing the Brother Developer Center ································· 50 - i - Raster Command Reference Introduction This material provides the necessary information for directly controlling the Brother printer PT-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 in a developer's environment. Details concerning the USB interface are not described in this material. If a USB interface is being used, refer to "Appendix A: USB Specifications" to prepare the interface. Read the model names that appear in the screens in this manual as the name of your printer. - 1 - Introduction Raster Command Reference About Raster Commands Using raster commands an PT-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. In this material, "raster" refers to binary bitmap data (collection of dots). Refer to this material to print by sending initialization commands and control codes together with raster data to the PT-XXXX printer (hereafter, referred to as "printer"). This manual describes the procedure for adding these codes and sending the data. - 2 - About Raster Commands 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.) () (3) Send the print data At your side Computer, mobile terminal, etc. (5) Send the status (Confirm that printing is completed.) Your printer (6) Close the port (4) Print - 3 - 1. Printing Using Raster Commands Raster Command Reference (1) Open the USB/network/Bluetooth port Open the USB/network/Bluetooth port in the operating environment. The procedure for opening the USB/network/Bluetooth port is not described in this material. (2) Confirm the printer status sent from the printer The "status information request" command is sent to the printer, the status information received from the printer is analyzed, and then the status of the printer is determined. For details on the "status information request" command and on the definitions of "status", refer to "Status information request" in "4. Printing Command Details". (3) Send the print data If the status analysis confirms that media compatible with the print data is loaded into the printer and that no error has occurred, the print data is sent. The structure of the print data is explained in the next section, "2. Print Data". Note: No command can be sent to the printer after the print data is transmitted and until the completion of printing is confirmed. Even the "status information request" command cannot be sent during printing. (4) Print the data (5) Confirm that printing is completed When printing is completed, the status is received from the printer. If this status is analyzed to confirm that printing is completed, printing one page is considered finished. If the print job has multiple pages, (2) through (4) are repeated. (6) Close the USB/network/Bluetooth port After all printing is finished, close the USB/network/Bluetooth port. Note: In order to print at high speed when a USB port is used to send uncompressed raster data, the Brother PT-XXXX starts printing when it starts to receive print data, instead of waiting for a print command (concurrent printing). For the processing flow, for example when managing errors, refer to "5. Flow Charts". - 4 - 1. Printing Using Raster Commands 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. 2 Initialize Initializes for printing. 1Bh, 40h (Fixed) (2) Control codes Added at the beginning of each page and sent for each page. Sequence Command Name Description/Example 1 Switch dynamic command mode Switches the printer to raster mode. 1Bh, 69h, 61h, 01h 2 Specify automatic status notification mode (PT-P910BT only) Dynamically switches whether an automatic status notification is given during printing. 1Bh, 69h, 21h, 00h Sets the print information for the printer. 3 Print information command When printing 100 mm on 24-mm-wide tape with the 180 dpi model: 1Bh, 69h, 7Ah, 84h, 00h, 18h, 00h, 9Ch, 02h, 00h, 00h, 00h, 00h 4 Various mode settings When auto cut is enabled: 1Bh, 69h, 4Dh, 40h When an auto cut setting is effective, specify the number of Specify the page sheets for auto cut. 5 number in "cut each * labels" For auto cut every single sheet, 1Bh, 69h, 41h, 01h 6 Advanced mode settings When half cut is enabled, and chain printing is disabled: 1Bh, 69h, 4Bh, 0Ch 7 Specify margin amount Specifies the amount of the margins. For 1 mm margins on the 360 dpi model: 1Bh, 69h, 64h, 0Eh, 00h 8 Select compression mode Selects the compression mode for raster graphics. To send the data compressed to TIFF format: 4Dh, 02h - 5 - 2. Print Data 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". Sends a raster line with all pixels set to "0". (Valid only when - Zero raster graphics TIFF is selected as the compression mode) 5Ah (Fixed) (4) Print commands Specified at the end of the page. Sequence Command Name - Print command - Print command with feeding Description/Example Specifies at the end of a page that is not the last page. 0ChFixed Specifies at the end of the last page. 1Ah (Fixed) - 6 - 2. Print Data 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. Furthermore, this procedure is for the Windows® 10 operating environment. A similar procedure can be performed if you are using a different operating system. Print Properties 2.2.1 Preparation Install the two listed below. Printer driver of the Brother PT-XXXX Binary file editor The data that we will analyze in this sample is a binary file. Therefore, use a binary file editor to display and check the contents of the binary file. 2.2.2 Checking the print data The procedure for checking the print data is provided below. Step 1: Change the port of the printer to "FILE:". Step 2: Print the desired item (in this case, the test page), and then specify the file name. Step 3: Open the created file in the binary file editor to check it. - 7 - 2. Print Data 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 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. Print the test page with "36mm" selected as the paper size in the print settings. - 8 - 2. Print Data 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. Save Print Output As Step 3: Open the print data in the binary file editor. Open the saved file in the binary file editor. The rows of numbers that appear are the print data. (Refer to the illustration below.) The print data is constructed of the following: (1) Initialization commands, (2) Control codes, (3) Raster data and (4) Print commands, which were described in "2.1 Print data overview". For details on the print data, refer to "2.2.3 Explanation of print data for the test page". Print data - 9 - 2. Print Data 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. Print Data 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 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. 4 Job ID setting commands Internal specification commands Since this is a command for outputting with the commercial version driver, it is unnecessary for the user to send this command. 5 Print information command Media size information for the print data is sent. This is the command for "36 mm" tape. 6 Various mode settings This is a command for specifying a mode. (1Bh+69h+4Dh+40h) Here, automatically cutting is specified. 7 Specify the page number in "cut each * labels" The number of pages printed before automatically cutting is specified. 8 Advanced mode settings This is the command for specifying settings for the advanced mode. In this case, "no chain printing" is enabled, and "half cut" is enabled. 9 Specify number of copies Internal specification commands Since this is a command for outputting with the commercial version driver, it is unnecessary for the user to send this command. 10 Specify margin amount Specifies the amount of the margins. This is the command for "14 dots". 11 Select compression mode TIFF compression mode is selected. 12 Raster data Raster data continues. 13 Print command with feeding Since it is the last page, the print command with feeding is sent at the end of the page. - 11 - 2. Print Data 2.3 Page data details 2.3.1 Resolution PT-P900/P900W/P950NW Resolution 360 dpi high, 360 dpi wide 360 dpi high, 720 dpi wide PT-P910BT Resolution 360 dpi high, 360 dpi wide Raster Command Reference Height-to-Width Proportion 1:1 1:2 Height-to-Width Proportion 1:1 - 12 - 2. Print Data 2.3.2 Page size (a) Continuous length tape Raster Command Reference 6 5 1 3 2 4 Print area Feeding direction Landscape Number TZe tape 1 Width 3 Print area width (maximum printing width) 5 Width offset ID Tape Size Designation 1 2 2 Length 4 Print area length 6 Length offset 3 4 5 263 3.5 mm 3.5 mm 0.13" 3.38 mm 48 dots 2.3.4 3.38 mm 48 dots 2.3.4 0.00 mm 0 dots 257 6 mm 6 mm 0.23" 6.00 mm 84 dots 2.3.4 4.52 mm 64 dots 2.3.4 0.74 mm 10 dots 258 9 mm 9 mm 0.35" 9.00mm 128 dots 2.3.4 7.48 mm 106 dots 2.3.4 0.76 mm 11 dots 259 12 mm 12 mm 0.47" 12.0 mm 170 dots 2.3.4 10.58 mm 150 dots 2.3.4 0.71 mm 10 dots 260 18 mm 18 mm 0.70" 18.01 mm 256 dots 2.3.4 16.51 mm 234 dots 2.3.4 0.75 mm 11 dots 261 24 mm 24 mm 0.94" 24.00 mm 340 dots 2.3.4 22.58 mm 320 dots 2.3.4 0.71 mm 10 dots 262 36 mm 36 mm 1.4" 36.09 mm 512 dots 2.3.4 32.03 mm 454 dots 2.3.4 2.03 mm 29 dots 6 2.3.3 2.3.3 2.3.3 2.3.3 2.3.3 2.3.3 2.3.3 - 13 - 2. Print Data Raster Command Reference Heat-Shrink Tube ID Tape Size Designation 1 415 6 mm HS 5.8mm HS 0.23" 5.60 mm 80 dots 416 9 mm HS 8.8mm HS 0.34" 8.70 mm 124 dots 417 12 mm HS 11.7mm HS 0.46" 11.6 mm 164 dots 418 18 mm HS 17.7mm HS 0.69" 17.8 mm 252 dots 419 24 mm HS 23.6mm HS 0.93" 23.7 mm 336 dots 2 2.3.4 2.3.4 2.3.4 2.3.4 2.3.4 3 3.95 mm 56 dots 6.77 mm 96 dots 9.31 mm 132 dots 14.96 mm 212 dots 18.06 mm 256 dots 4 2.3.4 2.3.4 2.3.4 2.3.4 2.3.4 5 0.85 mm 12 dots 1.00 mm 14 dots 1.10 mm 16 dots 1.40 mm 20 dots 2.80 mm 40 dots 6 2.3.3 2.3.3 2.3.3 2.3.3 2.3.3 - 14 - 2. Print Data (b) Split size Raster Command Reference Number TZe tape 1 Width 3 Print area width (maximum printing width) 5 Width offset 7 Overall width ID Tape Designation 1 Size 3 5 2 Length 4 Print area length 6 Length offset 8 Width of overall print area 7 [3] x Split number + [5] x 2 8 [3] x Split number 279 12 mm 12 mm x 2 0.47" x 2 12.00 mm 11.99 mm 0.00 mm 12.00 mm x 2 + 0.00 mm x 2 170 dots 170 dots 0 dots 170 dots x 2 + 0 dots x 2 12.00 mm x 2 170 dots x 2 285 12 mm 12 mm x 3 0.47" x 3 12.00 mm 11.99 mm 0.00 mm 12.00 mm x 3 + 0.00 mm x 2 170 dots 170 dots 0 dots 170 dots x 3 + 0 dots x 2 12.00 mm x 3 70 dots x 3 291 12 mm 12 mm x 4 0.47" x 4 12.00 mm 11.99 mm 0.00 mm 12.00 mm x 4 + 0.00 mm x 2 170 dots 170 dots 0 dots 170 dots x 4 + 0 dots x 2 12.00 mm x 4 70 dots x 4 280 18 mm 18 mm x 2 0.70" x 2 18.01 mm 17.92 mm 0.04 mm 18.01 mm x 2 + 0.04 mm x 2 256 dots 254 dots 1 dots 254 dots x 2 + 1 dots x 2 18.01 mm x 2 254 dots x 2 286 18 mm 18 mm x 3 0.70" x 3 18.01 mm 17.92 mm 0.04 mm 18.01 mm x 3 + 0.04 mm x 2 256 dots 254 dots 1 dots 254 dots x 3 + 1 dots x 2 18.01 mm x 3 254 dots x 3 292 18 mm 18 mm x 4 0.70" x 4 18.01 mm 17.92 mm 0.04 mm 18.01 mm x 4 + 0.04 mm x 2 256 dots 254 dots 1 dots 254 dots x 4 + 1 dots x 2 18.01 mm x 4 254 dots x 4 281 24 mm 24 mm x 2 0.94" x 2 24.00 mm 23.99 mm 0.01 mm 24.00 mm x 2 + 0.01 mm x 2 24.00 mm x 2 340 dots 340 dots 0 dots 340 dots x 2 + 0 dots x 2 340 dots x 2 287 24 mm 24 mm x 3 0.94" x 3 24.00 mm 23.99 mm 0.01 mm 24.00 mm x 3 + 0.01 mm x 2 24.00 mm x 3 340 dots 340 dots 0 dots 340 dots x 3 + 0 dots x 2 340 dots x 3 293 24 mm 24 mm x 4 0.94" x 4 24.00 mm 23.99 mm 0.01 mm 24.00 mm x 4 + 0.01 mm x 2 24.00 mm x 4 340 dots 340 dots 0 dots 340 dots x 4 + 0 dots x 2 340 dots x 4 - 15 - 2. Print Data Raster Command Reference ID Tape Designation 1 Size 3 5 7 8 [3] x Split number + [5] x 2 [3] x Split number 282 36 mm 36 mm x 2 1.4" x 2 36.09 mm 32.03 mm 2.03 mm 32.03 mm x 2 + 2.03 mm x 2 32.03 mm x 2 512 dots 454 dots 29 dots 454 dots x 2 + 29 dots x 2 454 dots x 2 288 36 mm 36 mm x 3 1.4" x 3 36.09 mm 32.03 mm 2.03 mm 32.03 mm x 3 + 2.03 mm x 2 32.03 mm x 3 512 dots 454 dots 29 dots 454 dots x 3 + 29 dots x 2 454 dots x 3 294 36 mm 36 mm x 4 1.4" x 4 36.09 mm 32.03 mm 2.03 mm 32.03 mm x 4 + 2.03 mm x 2 32.03 mm x 4 512 dots 454 dots 29 dots 454 dots x 4 + 29 dots x 2 454 dots x 4 - 16 - 2. Print Data Raster Command Reference 2.3.3 Feed amount The feed amount (left and right margins) is defined below. 360dpi x 360dpi Type Minimum margin setting Maximum margin setting Normal 1 mm 0.04" 14 dots 127 mm 5.00" 1800 dots Minimum margin setting with no precut Unrelated to driver 27 mm 1.06" 382 dots 360dpi x 720dpi Type High resolution Minimum margin setting 1 mm 0.04" 28 dots Maximum margin setting 127 mm 5.00" 3600 dots Minimum margin setting with no precut Unrelated to driver 27 mm 1.06" 764 dots - 17 - 2. Print Data Raster Command Reference 2.3.4 Maximum and minimum lengths The maximum and minimum lengths are defined below. TZe tape 360dpi x 360dpi Type Minimum length Normal 4 mm 0.16" 57 dots Maximum length 1000 mm 39.37" 14173 dots 360dpi x 720dpi Type High resolution Minimum length 4 mm 0.16" 114 dots Maximum length 1000 mm 39.37" 28346 dots Heat-Shrink Tube (not supported for PT-P910BT) Type Minimum length Maximum length Normal 4.2 mm 0.16" 60 dots 500 mm 19.69" 7087 dots * The minimum length with the driver is based on the machine specifications (due to the machine cutter position), and the minimum length of tape that can be fed out is 27 mm. For example, even when the minimum print data of 4.2 mm is created, the print result will be the 27 mm of tape shown below, since the minimum length of tape that can be fed out is 27 mm. In other words, the print data will be on 27 mm of tape when the print data length is 27 mm or less. - 18 - 2. Print Data 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. Feeding direction Expansion direction Print area Rasterized RasterLine 4 Zero Raster 1 Zero Raster 1 RasterLine 3 RasterLine 2 RasterLine 1 Feeding direction Print area Print head The following shows the relationship between the raster graphics parameters and the pixels. MSB LSB 1stB MSB LSB 2ndB MSB LSB 3rdB MSB LSB 4thB ... - 19 - 2. Print Data Total number of pins: 560pin Number of pins for right margin Raster Command Reference Raster line First byte Left and right margins Number of print area pins Total number of pins Print area Last byte 0 pin Number of pins for left margin Pins on print head Feeding direction TZe tape Tape Type 3.5 mm 6 mm 9 mm 12 mm 18 mm 24 mm 36 mm Number of pins for left margin 248 240 219 197 155 112 45 Number of print area pins 48 64 106 150 234 320 454 Number of pins for right margin Number of bytes for raster graphics transfer 264 70 256 70 235 70 213 70 171 70 128 70 61 70 - 20 - 2. Print Data Raster Command Reference Heat-Shrink Tube Tape Type 6 mm 9 mm 12 mm 18 mm 24 mm Number of pins for left margin 244 224 206 166 144 Number of print area pins 56 96 132 212 256 Number of pins Number of bytes for raster for right margin graphics transfer 260 70 240 70 222 70 182 70 160 70 - 21 - 2. Print Data 3. Print Command List ASCII Code NULL ESC @ ESC i S ESC i a ESC i z ESC i M ESC i A ESC i K ESC i d M G Z FF Control-Z ESC i ! Binary Code 00 1B 40 1B 69 53 1B 69 61 1B 69 7A 1B 69 4D 1B 69 41 1B 69 4B 1B 69 64 4D 67 5A 0C 1A 1B 69 21 Raster Command Reference Description Invalidate Initialize Status information request Switch dynamic command mode Print information command Various mode settings Specify the page number in "cut each * labels" Advanced mode settings Specify margin amount (feed amount) Select compression mode Raster graphics transfer Zero raster graphics Print command Print command with feeding Switch automatic status notification mode - 22 - 3. Print Command List 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 @ Initialize ASCII: ESC @ Hexadecimal: 1B 40 Description Initializes mode settings. Also used to cancel printing. ESC i S Status information request ASCII: ESC Hexadecimal: 1B i S 69 53 Description Send a request to the printer for status information. For details on the status, refer to the previous section. The size is fixed at 32 bytes. Note Before sending print data to the printer, this command should be sent once. Since error information is automatically sent by the printer during printing, do not send this command while printing. For details on transmission of the status, refer to "5. Flow Charts". - 23 - 4. Printing Command Details Raster Command Reference Number 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 Offset 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 Size Name 1 Print head mark 1 Size 1 Brother code 1 Series code 1 Model code 1 Country code 1 Battery Level 1 Extended error 1 Error information 1 1 Error information 2 1 Media width 1 Media type 1 Number of colors 1 Fonts 1 Japanese fonts 1 Mode 1 Density 1 Media length 1 Status type 1 Phase type 1 Phase number (higher order bytes) 1 Phase number (lower order bytes) Value/Reference Fixed at 80h Fixed at 20h Fixed at "B" (42h) Fixed at "0" (30h) PT-P900: Fixed at "q" (71h) PT-P900W: Fixed at "o" (69h) PT-P950NW: Fixed at "p" (70h) PT-P910BT: Fixed at "x" (78h) Fixed at "0" (30h) Refer to table (10) below. Refer to table (11) below. Refer to table (1) below. Refer to table (2) below. Refer to table (3) below. Refer to table (4) below. Fixed at 00h Fixed at 00h Fixed at 00h Value specified where the "various mode settings" command 00h if not specified Fixed at 00h Refer to table (3) below. Refer to table (5) below. Refer to table (6) below. 23 24 25 26 27 31~32 22 23 24 25 26 30~31 1 Notification number Refer to table (7) below. 1 Expansion area (number of bytes) Fixed at 00h 1 Tape color information Refer to table (8) below. 1 Text color information Refer to table (9) below. 1 Reserved Fixed at 00h 1 Reserved Fixed at 00h - 24 - 4. Printing Command Details Raster Command Reference (1) Error information 1 Flag Mask Definition Bit 0 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7 01h "No media" error 02h "End of media" error 04h Cutter jam 08h Weak batteries 10h Printer in use 20h (Not used) 40h High-voltage adapter 80h (Not used) (2) Error information 2 Flag Mask Definition Bit 0 Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7 "Replace media" error 01h (with a serial connecting) Wrong media 02h "Expansion buffer full" error 04h Communication error 08h "Communication buffer full" error 10h "Cover open" error 20h Overheating error 40h "Black marking not detected" error 80h System error PT-P900 PT-P900W PT-P950NW Supported, -:Not supported PT-P910BT Supported, -:Not supported PT-P900 PT-P900W PT-P950NW Supported, -:Not supported PT-P910BT Supported, -:Not supported - - 25 - 4. Printing Command Details Raster Command Reference (3) Media width and length The media width and length is described in millimeters. 0255 (0 to FFh) (a) TZe tape * Media Width: The tape width is indicated in millimeters. * Media Length: Fixed at 00h Media Media Width Media Length PT-P900 PT-P900W PT-P950NW Supported, -:Not supported No tape 00h 00h 3.5 mm 04h 00h 6 mm 06h 00h 9 mm 09h 00h 12 mm 0Ch 00h 18 mm 12h 00h 24 mm 18h 00h 36 mm 24h 00h HS 5.8 mm 06h 00h HS 8.8 mm 09h 00h HS 11.7 mm 0Ch 00h HS 17.7 mm 12h 00h HS 23.6 mm 18h 00h FLe 21 mm x 45 mm 15h 2Dh PT-P910BT Supported, -:Not supported - - 26 - 4. Printing Command Details Raster Command Reference (4) Media type Media Type No media Laminated tape Non-laminated tape Fabric Tape Heat-Shrink Tube Fle tape Flexible ID tape Satin tape Incompatible tape Value 00h 01h 03h 04h 11h 13h 14h 15h FFh PT-P900 PT-P900W PT-P950NW Supported, -:Not supported PT-P910BT Supported, -:Not supported (5) Status type Status Type Value Reply to status request 00h Printing completed 01h Error occurred 02h Exit IF mode 03h (not used) Turned off 04h Notification 05h Phase change 06h (Not used) 07h to 20h (Reserved) 21h to FFh If an error occurred during printing, the printer returns the error status. - 27 - 4. Printing Command Details Raster Command Reference (6) Phase type and phase number If the phase number is not used, both are fixed at 00h. Phase State Editing state (reception possible) Printing state Phase Type 00h 01h Editing state Phase Editing state (reception possible) Feed Value (Dec.) 0 1 Higher Order Bytes 00h 00h Lower Order Bytes 00h 01h Printing state Phase Printing (Not used) Cover open while receiving (Not used) Value (Dec.) 0 10 20 25 Higher Order Bytes 00h 00h 00h 00h Lower Order Bytes 00h 0Ah 14h 19h (7) Notification number Notification Not available Cover open Cover closed Cooling (started) Cooling (finished) Value 00h 01h 02h 03h 04h - 28 - 4. Printing Command Details Raster Command Reference (8) Tape color information Tape color White Other Clear Red Blue Yellow Green Black ClearWhite text Matte White Matte Clear Matte Silver Satin Gold Satin Silver BlueD RedD Fluorescent Orange Fluorescent Yellow Berry PinkS Light GrayS Lime GreenS YellowF PinkF BlueF WhiteHeat-shrink Tube WhiteFlex. ID YellowFlex. ID Cleaning Stencil Incompatible Tape color ID 01h 02h 03h 04h 05h 06h 07h 08h 09h 20h 21h 22h 23h 24h 30h 31h 40h 41h 50h 51h 52h 60h 61h 62h 70h 90h 91h F0h F1h FFh Notes TZe-535(12 mm) TZe-545(18 mm) TZe-555(24 mm) TZe-435(12 mm) TZe-MQP35 TZe-MQL35 TZe-MQG35 - 29 - 4. Printing Command Details Raster Command Reference (9) Text color information Text color White Red Blue Black Gold BlueF Cleaning Stencil Other Incompatible (10) Battery Level PT-P900/P900W/P950NW Battery Level Full Half Low Need to be Charged Using AC adapter Unknown Value 00 h 01 h 02 h 03 h 04 h FF h PT-P910BT AC Adapter AC Adapter not connected AC Adapter connected Battery Level Full Half Low Need to be Charged Full Half Low Need to be Charged Battery not installed Text color ID 01h 04h 05h 08h 0Ah 62h F0h F1h 02h FFh Value 20 h 22 h 23 h 24 h 30 h 32 h 33 h 34 h 37 h - 30 - 4. Printing Command Details (11) Extended error Error Type Value Fle tape end 10h High-resolution/draft printing error 1Dh Adapter pull/insert error 1Eh Incompatible media error 21h Raster Command Reference PT-P900 PT-P900W PT-P950NW Supported, -:Not supported PT-P910BT Supported, -:Not supported - 31 - 4. Printing Command Details Raster Command Reference ESC i a Switch dynamic command mode ASCII: ESC Hexadecimal: 1B i a {n1} 69 61 {n1} Parameters Definitions of {n}: PT-P900/P900W/P950NW 0: ESC/P mode (default) 1: Raster mode (Be sure to switch to this mode.) 3: P-touch Template mode PT-P910BT 1: Raster mode (default) 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. Therefore, send this command to switch the printer to raster mode. - 32 - 4. Printing Command Details Raster Command Reference ESC i z Print information command ASCII: ESC i z {n1} {n2} {n3} {n4} {n5} {n6} {n7} {n8} {n9} {n10} Hexadecimal: 1B 69 7A {n1} {n2} {n3} {n4} {n5} {n6} {n7} {n8} {n9} {n10} Description Specifies the print information. Definitions of {n1} through {n10} {n1}: Valid flag; Specifies which values are valid #define PI_KIND 0x02 // Media type #define PI_WIDTH 0x04 // Media width #define PI_LENGTH 0x08 // Media length #define PI_QUALITY 0x40 // Priority given to print quality (Not used) #define PI_RECOVER 0x80 // Printer recovery always on {n2}: If flag 0x80 is specified... PT-P9100/900W/950NW: Both "Printer recovery" and "bi-directional communication" will be activated. The printer will send status notification when printing. PT-P910BT: "bi-directional communication" will not be activated. Please use "Switch automatic status notification mode" command to enable bi-directional communication with the printer when printing. Media type Laminated/Non-laminated tape: 00h Heat-Shrink Tube:11h Fle tape:13h Incompatible tape:FFh {n3}: {n4}: Note: PT-P9100/900W/950NW: High-resolution printing and draft printing are supported for Laminated tape only. Please set to 09h when printing. PT-P910BT: High-resolution printing and draft printing are not supported. {n3}: Media width (mm) {n4}: Media length (mm) For the media of width 24 mm, specify as n3 = 18h and n4 = 00h. n4 is normally 00h, regardless of the paper length. - 33 - 4. Printing Command Details Raster Command Reference {n5-n8}: {n9}: {n10}: Raster number = n8*256*256*256 + n7*256*256 + n6*256 + n5 If the media is not correctly loaded into the printer when the valid flag for PI_KIND, PI_WIDTH and PI_LENGTH are set to "ON", an error status is returned (Bit 0 of "(2) Error information 2" is set to "ON".) Starting page: 0 Other pages: 1 Last page: 2 The output will be 2 regardless of starting/last page for the job consists of single page. Fixed at 0 - 34 - 4. Printing Command Details 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. Bit 0 (Masked Bit = 0x01): (reserved) Bit 1 (Masked Bit = 0x02): (reserved) Bit 2 (Masked Bit = 0x04): (not used) Bit 3 (Masked Bit = 0x08): (not used) Bit 4 (Masked Bit = 0x10): (not used) Bit 5 (Masked Bit = 0x20): (not used) Bit 6 (Masked Bit = 0x40): Auto cut Bit 7 (Masked Bit = 0x80): Mirror printing Auto cut 1: Automatically cuts 0: Does not automatically cut Mirror printing 1: Mirror printing 0: No mirror printing Raster Command Reference - 35 - 4. Printing Command Details Raster Command Reference ESC i K Advanced mode settings ASCII: ESC Hexadecimal: 1B i K {n1} 69 4B {n1} Parameters Definitions of {n1} The meaning of each bit in a 1-byte parameter is described below. 0bit: Draft printing 1: Draft printing 0: Normal printing For PT-P910BT, please set this value as 0 (Draft printing is not supported). 1bit: Not used 2bitHalf cut 1: Half cut on 0: Half cut off 3bitNo chain printing When printing multiple copies, the labels are fed after the last one is printed. 1: No chain printingFeeding and cutting are performed after the last one is printed. 0: Chain printingFeeding and cutting are not performed after the last one is printed. 4bitSpecial tape (no cutting) Labels are not cut when special tape is installed. 1: Special tape (no cutting) ON 0: Special tape (no cutting) OFF 5bit: Not used 6bitHigh-resolution printing 1: High-resolution printing 0: Normal printing For PT-P910BT, please set this value as 0 (High-resolution printing is not supported). 7bitNo buffer clearing when printing (Not used for PT-P910BT) The expansion buffer of the machine is not cleared with the "no buffer clearing when printing" command. If this command is sent when the data of the first label is printed (it is specified between the "initialize" command and the print data), printing is possible only if a print command is sent with the second or later label. 1:No buffer clearing when printing ON 0:No buffer clearing when printing OFF - 36 - 4. Printing Command Details ESC i d Specify margin amount (feed amount) ASCII: ESC Hexadecimal: 1B i d {n1} {n2} 69 64 {n1} {n2} Description Specifies the amount of the margins. Margin amount (dots)=n1+n2*256 (a) Continuous length tape Paper Tape Print area Raster Command Reference Margin amount Cut line ESC i A Specify the page number in "cut each * labels" ASCII: ESC i A {n} Hexadecimal: 1B 69 41 {n} Parameters Definitions of {n} Page number = n1 (1 - 255) Default is 1 (cut each label). If 00h is set, label will not be cut. Description When "auto cut" is specified, you can specify page number (1 - 255) in "cut each * labels". - 37 - 4. Printing Command Details Raster Command Reference M Select compression mode ASCII: M {n} Hexadecimal: 4D {n} Parameters Definitions of {n} 0 No-compression mode (Enabled) 1 Reserved (Disabled) 2 TIFF (Enabled) 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. If different data is in a series, the number of data items and all of the different data are specified. If the same data is repeated, the number of data units is specified as the actual number minus 1, expressed as a negative number. If different data is in a series, the number of data units is specified as the number of bytes minus 1, expressed as a positive number. If the above process results in more than 70 bytes of compressed data, the data is treated as being all different. As a result, the data will be 71 bytes, including the 1 byte that specifies the data length. Example 1 raster of raster graphics transfer: Without compression: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 22 22 23 BA BF A2 22 2B...... With compression: ED 00 FF 22 05 23 BA BF A2 22 2B ... a b c a. Since "00h" is repeated for 20 bytes, 20d -> 19d -> 13h changed into a negative number is EDh. Therefore: ED 00 b. Since "22h" is repeated for 2 bytes, 2d -> 1d -> 1h changed into a negative number is FFh. Therefore: FF 22 c. The following 6 bytes remain unchanged. 6d -> 5d -> 5h Therefore: 05 23 BA BF A2 22 2B Continue for the remaining number of bytes for the uncompressed data. Even if 00h continues until the end, it cannot be omitted. - 38 - 4. Printing Command Details Raster Command Reference Explanation of "TIFF compression mode" With compression, the data for the "raster graphics transfer" command is based on 70 bytes of the total number of pins (560). 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. However, with compression, the number of unused pins is also added to the data. In other words, with compression, this becomes 70 bytes when it is expanded by the printer, regardless of the tape width. Raster line with compression Raster line with no compression 0 pin First byte Number of offset pins Tape margin Number of print area pins Total number of pins Print area Number of unused pins Last byte Pins on print head Feeding direction - 39 - 4. Printing Command Details Raster Command Reference G Raster graphics transfer ASCII: G Hexadecimal: 47 {n1} {n2} {d1} ... {dk} {n1} {n2} {d1} ... {dk} Description Transfers the specified number of bytes (k) of data. The data is expanded by overwriting from the position where the margin was added. If the expanded data does not reach the end of the expansion buffer, the remainder is filled with 0 data. If the expanded data exceeds the end of the expansion buffer, the excess is cut off. Parameters {n1}{n2} Specified number of bytes k = n1 + n2*256 0000h Specified number of bytes k First positive number that exceeds the value of the number of print head pins divided by 8 (Gauss number) {k} Number of bytes of raster data (d1 to dk) However, use the following value if no compression is specified as the compression mode. k=70 {d1~dk} Raster data. Z Zero raster graphics ASCII: Z Hexadecimal: 5A Description Fills raster line with 0 data. FF Print command ASCII: FF Hexadecimal: 0C Description Used as a print command at the end of pages other than the last page when multiple pages are printed. - 40 - 4. Printing Command Details Control-Z Print command with feeding ASCII: Control-Z Hexadecimal: 1A Description Used as a print command at the end of the last page. Raster Command Reference ESC i ! Specify automatic status notification mode ASCII: ESC i ! {n1} Hexadecimal: 1B 69 21 {n1} Parameters Definitions of {n1} 0: Notify. 1: Do not notify. (default) Description Dynamically switches whether the automatic status notification is given during printing. A printer that receives this command operates in the specified command mode until the printer is turned off. Use this command when building a system where the status is not obtained. - 41 - 4. Printing Command Details 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 printingPrinting starts immediately after the printer receives print data. Buffered printingPrinting starts after one page of print data is received. - 42 - 5. Flow Charts Raster Command Reference 5.1 Concurrent printing normal flow for USB connection Computer (host) If there are no problems with the printer status (media, etc.), the data is READ transmitted. If there is a problem, an error appears. Displaying sending Invalidate Initialize Status information request Status (response to status information request) Printer The printer is reset. The printer is initialized. The status of the printer (media, etc.) is checked and a response is sent. Sending control codes Sending raster data Status (Phase change: "Printing") Data received. Beginning printing without waiting for a print command Printing Sending raster data Sending raster data Sending raster data Display ing printing READ Phase change "Printing" received. "Printing completed" received. Finishing process for printing page 1 Sending data for page 2 Sending a print command (print command with feeding (1A) for the last page or print command (0C) for other pages) Status ("Printing completed") Status (Phase change: "Waiting to receive") Sending control code/raster data Status (Phase change: "Printing") Sending raster data Sending raster data Sending raster data Printing of the 1st page is actually not finished, but the "Printing completed" status and "Waiting to receive" phase are sent. Printing 1st page Printing 2nd page - 43 - 5. Flow Charts 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, etc.), the data is READ transmitted. If there is a problem, an error appears. Displaying sending Invalidate Initialize Status information request Status (response to status information request) Printer The printer is reset. The printer is initialized. The status of the printer (media, etc.) is checked and a response is sent. Sending control codes Data received. Sending raster data Status (Phase change: "Printing") Beginning printing without waiting for a print command Printing Sending raster data Displaying printing READ Phase change "Printing" received. "Printing completed" received. Finishing process for printing page 1 Sending data for page 2 Displaying printing Displaying printing READ "Error Occured" received. An error appears. When restarted, data is resent starting with the 1st page since "Printing" for the 2nd page is not received. Resending process for data of 1st page Sending a print command (print command with feeding (1A) for the last page or print command (0C) for other page) Status ("Printing completed") Status (Phase change: "Waiting to receive") Sending control code/raster data Sending raster data Status ("Error occurred") Sending raster data Sending a print command (print command with feeding (1A) for the last page or print command (0C) for other pages) Initialize Printing of the 1st page is actually not finished, but the "Printing completed" status and "Waiting to receive" phase are sent. Error occurred If an error occurs, all data read from the computer is cleared. Reprinting 1st page - 44 - 5. Flow Charts Raster Command Reference 5.3 Concurrent printing error flow for USB connection (with a concurrent printing error such as end of tape) Computer (host) If there are no problems with the printer status (media, etc.), the data is transmitted. If there is a problem, an error appears. READ Displaying sending Invalidate Initialize Printer Any jobs with errors remaining in the printer are cleared. The printer is initialized. Status information request Status (response to status information request) The status of the printer (media, etc.) is checked and a response is sent. Sending control codes Sending raster data Status (Phase change : "Printing") Data received. Beginning printing without waiting for a print command Printing Sending raster data Displaying printing Phase change "Printing" received. READ "Printing completed" received. Phase change "Waiting to receive" received. Finishing process for printing page 1 Sending data for page 2 Sending a print command (print command with feeding (1A) for the last page or print command (0C) for other pages) Status ("Printing completed") Status (Phase change: "Waiting to receive") Sending control code/raster data Printing of the 1st page is actually not finished, but the "Printing completed" status and "Waiting to receive" phase are sent. Status (Phase change : "Printing") Printing 1st page Printing 2nd page Sending raster data Status ("Error Occurred") Sending raster data Displaying printing Phase change READ "Printing" received. "Error Occured" received. An error appears. When restarted, data is resent starting with the 2nd page since "Printing" for the 2nd page is received. Resending process for data of 2nd page Sending a print command (print command with feeding (1A) for the last page or print command (0C) for other pages) Initialize Error occurred If an error occurs, all data read from the computer is cleared. Reprinting 2nd page - 45 - 5. Flow Charts Raster Command Reference 5.4 Buffered printing normal flow for USB/Bluetooth connection Computer (host) If there are no problems with the printer status (media, etc.), the data is READ transmitted. If there is a problem, an error appears. Displaying sending Invalidate Initialize Status information request Status (response to status information request) Sending control codes Sending raster data Printer The printer is reset. The printer is initialized. The status of the printer (media, etc.) is checked and a response is sent. Data received. Displaying printing Sending raster data Sending raster data Sending raster data Sending a print command (print command with feeding (1A) for the last page or print command (0C) for other page) Printing Phase change "Printing" received. READ "Printing completed" received. Status (Phase change: "Printing") Status ("Printing completed") Phase change "Waiting to receive" received. Finishing process for printing 1st page Sending data for 2nd page Status (Phase change: "Waiting to receive") Sending control codes Printing 1st page Printing 2nd page Sending raster data Sending raster data - 46 - 5. Flow Charts Raster Command Reference 5.5 Buffered printing error flow for USB/Bluetooth connection Computer (host) If there are no problems with the printer status (media, etc.), the READ data is transmitted. If there is a problem, an error appears. Invalidate Initialize Status information request Status (response to status information request) or an error is displayed Printer The printer is reset. The printer is Initialized. The status of the printer (media, etc.) is checked and a response is sent. Displaying sending Displaying printing READ Phase change "Printing" received. Sending control codes Sending raster data Sending a print command (print command with feeding (1A) for the last page or print command (0C) for other page) Status (Phase change: "Printing") Data received. Printing Status ("Error Occurred") Error occurred - 47 - 5. Flow Charts Raster Command Reference 5.6 Normal Flow for Network (Standard TCP/IP port) Connection *With a network connection, print data from the operating system's port monitor is simply sent as is. When it prints 2 pages data Computer (host) Divide print data into particular size, and send it. Sending raster data Sending raster data Printer Sending raster data Sending raster data Receive data End process for printing 1st Sending data for 2nd page BUSY Sending raster data Sending raster data Sending raster data Sending raster data As one page data receives in the printer buffer, start printing Printing 1st page Printer buffer is full BUSY Sending raster data BUSY Sending raster data BUSY At host side, as sending print data has completed, the print job data is erased. The print job is treated to be completion at printer side Sending raster data Sending raster data Sending raster data Sending raster data Sending raster data Sending raster data As 2nd page data receives in the printer buffer, start printing. Printing 2nd page - 48 - 5. Flow Charts Raster Command Reference Appendix A: USB Specifications USB specifications 1.1 Item Vendor ID 0x04F9 Description Product ID Class Character string for manufacturer Character string for serial number Device speed Number of interfaces With the printer class Power supply End point 1 End point 2 PT-P900W 0x2085 PT-P950NW 0x2086 PT-P900 0x2083 PT-P910BT 0x20c7 Printer Character string descriptor: 0x01 0x0409: "Brother" Character string descriptor: 0x03 0x0409: "000" + Last nine digits of the printer's serial number Full speed 1 (No alternate interfaces) Self-powered (As a printer class, Bus power is also set to "ON".) In bulk (Sends the status from the printer to the computer.) Maximum packet size: 64 bytes Out bulk (Sends print commands and data from the computer to the printer.) Maximum packet size: 64 bytes - 49 - Appendix A: USB Specifications 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. http://www.brother.com/product/dev/index.htm - 50 Appendix B: Introducing the Brother Developer CenterMicrosoft Word for Office 365