brother Windows DLL Software Developer
Copyright
©2020 Brother Industries, Ltd. All rights reserved. Information in this document is subject to change without notice. The software described in this document is furnished under a license agreement. The software may be used or copied only in accordance with the terms of those agreements. No part of this publication can be reproduced in any form or by any means without prior written permission of Brother Industries, Ltd.
Trademarks
Brother is either a trademark or a registered trademark of Brother Industries, Ltd.
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 Note
This document provides information for the label printer (See 4.1 Supported Printers) and is available for use only if you agree to the following conditions:
No Warranty
a. The contents of this document are subject to change without notice.
b. Regarding this document, Brother will not guarantee that there are no defects or if the purpose matches the specific purpose, regardless of whether it is explicit or implied.
c. Brother assumes no responsibility for damages, actions of third parties, the user’s intentional or negligent operation, misuse, or operation under other special conditions.
Contact Information
For more information for mobile printer developers, visit
https://support.brother.com/g/s/es/dev/en/index.html?navi=offall
Guide
Printing a Label
- Example:
Printing using the Printer Commands
To send printer commands (Example: FBPL, ZPL), use the sendcommand
functions
- Example:
Printing using an FBPL Template
- Create a template using FBPL commands (.BAS).
- Transfer the template to the printer’s FLASH memory using the BPM (Brother Printer Management Tool).
- Call the template and insert the text you want using the
sendcommand
functions.
- Example:
Printing an Image
To recall and print a PCX/BMP image (Example: logo), download the file to the printer’s FLASH memory, using the downloadpcx
functions. Then call the image by sending the FBPL commands. For more information about the FBPL commands, see the PUTPCX or PUTBMP command in the FBPL Command Reference.
- For bitmap printing, download either a 1-bit (monochrome) or 8-bit (256-color) BMP graphic file only.
- Print the downloaded image in monochrome or grayscale using the PUTPCX or PUTBMP command. The direct thermal mode supports both monochrome printing and grayscale printing. The thermal transfer mode supports monochrome printing only
Encoding an RFID Tag
To encode RFID tags, use the rfidWrite
function.
- Example:
- Supported Printers:
- TD-4650TNWBR
- TD-4750TNWBR
- TJ-4021TNR
- TJ-4121TNR
API
open port
Start the Windows printer spool.
Declaration
int openport (String port);
Parameters
Parameter | Type | Required | Description |
port | string | Yes | 1) Printer driver name for local printer (Example: Brother TD-4420TN ) |
2) UNC path and printer name for a network printer (Example: ”\\server\TD-4420TN”) |
|||
3) LPT1 to LPT4 for Centronics Interface (Example: ”LPT1” ) |
|||
4) USB interface (Example: ”USB” ) |
Return Value
integer; 1 if success, otherwise 0.
opennetport
Start the Windows printer spool by designating the IP address.
Declaration
int opennetport (String IP address, int printer port);
Parameter
Parameter | Type | Required | Description |
IP address | string | Yes | Printer IP address(Example: ”192.168.0.1”) |
Printer port | integer | Yes | Printer connection port(Example:9100) |
Returned Value
integer; 1
if success, otherwise 0
closeport
Close the Windows printer spool.
Declaration
int closepor ();
Parameters
None
Return Value
integer; 1 if success, otherwise 0.
setup
Configure the printer settings
Declaration
int setup (String width, String height, String speed, String density, String sensorType, String gap, String distance);
Parameters
Parameter | Type | Required | Description |
|
string | Yes | Label width (mm) |
|
string | Yes | Label height (mm) |
|
string | Yes | Print speed (inch/second)1 / 1.5 / 2 / 3 / 4 / 6 / 8 / 10 / 12 / 13 / 14 For more information about the available print speed settings, see the SPEED command in the FBPL command reference. |
|
string | Yes | Print density0-15: 0 Lightest, 15 Darkest |
|
string | Yes | Media sensor type0 : Gap sensor, 1: Black mark sensor |
|
string | Yes | Gap distance between two labels or the height of the black mark (mm) |
|
string | Yes | Shift the distance of the gap/black mark (mm); Set this parameter to 0 when using the normal label type. |
Return Value
integer; 1
if success, otherwise 0
.
To set the paper type to continuous paper, specify 0 for the parameters
sensor Type
, gap, and distance
.
clear buffer
Clear the buffer
Declaration
int clearbuffer();
Parameters
None
Return Value
integer; 1 if success, otherwise 0.
barcode
Use built-in barcode formats
Declaration
int barcode(String xDir, String yDir, String barcode, String height, String interpretation, String rotation, String narrowRatio, String wideRatio, String content);
Parameters
Parameter | Type | Required | Description |
xDir |
string | Yes | Starting point of the barcode in the X direction (dots) (203 dpi: 1 mm=8 dots, 300 dpi: 1 mm=12 dots, 600 dpi: 1 mm=24 dots) |
yDir |
string | Yes | Starting point of the barcode in the Y direction (dots) (203 dpi: 1 mm=8 dots, 300 dpi: 1 mm=12 dots, 600 dpi: 1 mm=24 dots) |
barcode |
string | Yes | Barcode type For more information, see the Barcode Type section. |
height |
string | Yes | Barcode height (dots) |
interpretation |
string | Yes | Human recognizable interpretation (text) 0: Not readable, 1: Human readable |
rotation |
string | Yes | Rotation degrees0 : No rotation90 : Rotate 90 degrees clockwise180 : Rotate 180 degrees clockwise270 : Rotate 270 degrees clockwise |
|
string | Yes | Narrow bar ratio For more information about the ratio, see the BARCODE command in the FBPL Command Reference. |
wideRatio |
string | Yes | Wide bar ratio For more information about the ratio, see the BARCODE command in the FBPL Command Reference. |
content |
string | Yes | Barcode content |
Return Value
integer; 1
if success, otherwise 0
.
Barcode Type
Select the barcode
type from the list.
Barcode Type | Description | |
128 |
Code 128, switching code subset automatically | |
128M |
Code 128, switching code subset manually | |
EAN128 |
EAN-128, switching code subset
automatically |
|
EAN128M |
EAN-128M (GS1-128), switching code subset manually | |
25 |
Interleaved 2-of-5 | |
25C |
Interleaved 2-of-5 with check digit | |
25S |
Standard 2-of-5 | |
25I |
Industrial 2-of-5 | |
39 |
Code 39, switching standard and full ASCII mode automatically | |
39C |
Code 39 with check digit | |
93 |
Code 93 | |
EAN13 |
EAN-13 | |
EAN13+2 |
EAN-13 with 2 digits add-on | |
EAN13+5 |
EAN-13 with 5 digits add-on | |
EAN8 |
EAN-8 | |
EAN8+2 |
EAN-8 with 2 digits add-on | |
EAN8+5 |
EAN-8 with 5 digits add-on | |
CODA |
Codabar (NW-7) | |
POST |
POSTNET | |
LOGMARS |
A special use of Code 39 | |
UPCA |
UPC-A | |
UPCA+2 |
UPC-A with 2 digits add-on | |
UPA+5 |
UPC-A with 5 digits add-on | |
UPCE |
UPC-E | |
UPCE+2 |
UPC-E with 2 digits add-on | |
UPE+5 |
UPC-E with 5 digits add-on | |
MSI |
MSI | |
MSIC |
MSI with check digit | |
PLESSEY |
Plessey | |
CPOST |
Datalogic 2-of-5 (China post) | |
ITF14 |
ITF-14 | |
EAN14 |
EAN-14 | |
11 |
Code 11 (USD-8) | |
TELEPEN |
Telepen | |
TELEPENN |
Telepen number | |
PLANET |
Planet | |
CODE49 |
Code 49 | |
DPI |
Deutsche Post Identcode | |
DPL |
Deutsche Post Leitcode |
To print other barcodes, send FBPL commands using the
sendcomman
d function.
Example: sendcommand("QRCODE 10,10,H,4,A,0,\"ABCabc123\"\r\n")
printerfont
Define a text object in built-in fonts.
Declaration
int printerfont(StringxDir,StringyDir,StringfontType,Stringrotation,StringxRate,StringyRate,Stringcontent);
Parameters
Parameter | Type | Required | Description |
xDir | string | Yes | Starting point of text (character string) in the X direction (dots) (203 dpi: 1 mm=8 dots, 300 dpi: 1 mm=12 dots, 600 dpi: 1 mm=24 dots) |
yDir | string | Yes | Starting point of text (character string) in the Y direction (dots) (203 dpi: 1 mm=8 dots, 300 dpi: 1 mm=12 dots, 600 dpi: 1 mm=24 dots) |
font Type | string | Yes | Font type name
Make sure the file name is in uppercase letters (Example: |
rotation | string | Yes | Rotation degree of the text0 : No rotation90 : Rotate 90 degrees clockwise180 : Rotate 180 degrees clockwise270 : Rotate 270 degrees clockwise |
xRate | string | Yes | Character height magnification (Range: 1-8) |
yRate | string | Yes | Character width magnification (Range: 1-8) |
content | string | Yes | Characters to be printed |
Return Value
integer; 1 if success, otherwise 0.
To use the built-in fonts, select the font Type from the list.
Font Name | Description |
0 | Monotype CG Triumvirate Bold Condensed scalable font |
1 |
8 x 12 fixed pitch dot font |
2 |
12 x 20 fixed pitch dot font |
3 |
16 x 24 fixed pitch dot font |
4 |
24 x 32 fixed pitch dot font |
5 |
32 x 48 dot fixed pitch font |
6 |
14 x 19 dot fixed pitch font OCR-B |
7 |
21 x 27 dot fixed pitch font OCR-B |
8 |
14 x25 dot fixed pitch font OCR-A |
ROMAN.TTF |
Monotype CG Triumvirate Bold Condensed, fixed font width and height proportion |
1.EFT |
EPL2 font 1 |
2.EFT |
EPL2 font 2 |
3.EFT |
EPL2 font 3 |
4.EFT |
EPL2 font 4 |
5.EFT |
EPL2 font 5 |
A.FNT |
ZPL2 font A |
B.FNT |
ZPL2 font B |
D.FNT |
ZPL2 font D |
E8.FNT |
ZPL2 font E8 |
F.FNT |
ZPL2 font F |
G.FNT |
ZPL2 font G |
H8.FNT |
ZPL2 font H8 |
GS.FNT |
ZPL2 font GS |
To use the downloaded fonts, download your fonts to the printer using the Brother Printe Management Tool (BPM):
- Run the BPM.
- Click the File Manager.
- Select the file type from the drop-down list, and then click Browse to select the font file.
- Select FLASH from the Memory Device drop-down list.
- Click Download to start downloading the file.
Make sure the file name is in uppercase letters. (Example: ipaexg.ttf → IPAEXG.TTF)
- The BPM is a Windows tool and it does not support the Bluetooth® connection. When using the BPM, connect the printer to your computer via USB or Wi-Fi®.
If the printer’s encoding setting and the print data encoding do not match, print quality errors, such as garbled characters or missing text, will occur. If the font is not compatible with the encoding, change the encoding or the selected font. To change the printer’s encoding setting, see the CODEPAGE command in the FBPL Command Reference.
sendcommand
Send a command to the printer.
Declaration
intsendcommand(Stringcommand);
Parameters
Parameter | Type | Required | Description |
command | string | Yes | Built-in commands (Example: FBPL commands)
For more information about FBPL commands, see the FBPL Command Reference. |
Example: sendcommand(“PRINT 1\r\n”) sendcommand(“CLS\r\nPRINT\r\n”)
Return Value
integer; 1
if success, otherwise 0
.
You can send non-FBPL commands that your printer’s firmware supports. When sending non-FBPL
commands with sendcommand,
use this API only with openport
and closeport
.
printl a bel
Print a label.
Declaration
intprintlabel(Stringset,Stringcopy);
Parameters
Parameter | Type | Required | Description |
set | string | Yes | Number of label sets |
copy | string | Yes | Number of label copies |
Return Value
integer; 1
if success, otherwise 0
download pcx
Download a monochrome PCX/BMP graphic file to the printer.
Declaration
intdownloadpcx(StringfileName,Stringname);
Parameters
Parameter | Type | Required | Description |
file Name | string | Yes | File name (including file retrieval path) |
name | string | Yes | File name (the name of the file downloaded to FLASH) Make sure the file name is in uppercase letters (FILENAME.PCX, FILENAME.BMP) |
Return Value
integer; 1 if success, otherwise 0
For more information, see 1.4 Printing an Image.
form feed
Skip to the next page of a label. Make sure you set this function after calling the setup function.
Declaration
int formfeed();
Parameters
None
Return Value
integer; 1 if success, otherwise 0.
no back feed
Disable the backfeed function
Declaration
int nobackfeed();
Parameters
None
Return Value
integer; 1 if success, otherwise 0.
windows font
Define a text object using Windows fonts.
Declaration
int windows font(int xDir, int yDir, int height, int rotation, int font Style, int underline, String fileType, String text);
Parameters
Parameter | Type | Required | Description |
xDir |
integer | Yes | Starting point of text (character string) in the X direction (dots) (203 dpi: 1 mm=8 dots, 300 dpi: 1 mm=12 dots, 600 dpi: 1 mm=24 dots) |
yDir |
integer | Yes | Starting point of text (character string) in the Y direction (dots) (203 dpi: 1 mm=8 dots, 300 dpi: 1 mm=12 dots, 600 dpi: 1 mm=24 dots) |
height |
integer | Yes | Font height (dots) |
rotation |
integer | Yes | Rotation degree of the text0 : No rotation90 : Rotate 90 degrees clockwise180 : Rotate 180 degrees clockwise270 : Rotate 270 degrees clockwise |
fontStyle |
integer | Yes | Font style0 : Normal1 : Italic2 : Bold3 : Bold and Italic |
underline |
integer | Yes | Font with underline0 : without underline1 : with underline |
fileType |
integer | Yes | Font name |
text |
integer | Yes | Characters to be printed |
Return Value
integer; 1 if success, otherwise 0.
about
Display the DLL version on the screen.
Declaration
voidabout();
Parameters
None
Return Value
integer; 1 if success
rfid Write
Write data to the RFID tag.
Declaration
intrfidWrite(Stringlock,Stringformat,StringblockNumber,StringdataSize,StringmemoryBank,String data);
Parameters
Parameter | Type | Required | Description |
lock |
string | Yes | Optional parameter to lock the data to prevent it from being overwritten0 : Write without locking1 to FFFFFFFF in hex : Write and lock the data block |
format |
string | Yes | Format of the field dataA = ASCIIH = Hex |
block Number |
string | Yes | Specifies 0 |
data Size |
string | Yes | Write data size from 1 to n in decimal numbers |
memory Bank |
string | Yes | Memory bankEPC – EPC area (Up to 496 bits)USR – User area (Up to 8 kilobits)ACS – Access code areaKIL – Kill code areaPC – PC code area |
data |
string | Yes | Contents of data string |
Return Value
integer; 1 if success, otherwise 0
- Supported Printers: TD-4650TNWBR, TD-4750TNWBR, TJ-4021TNR, and TJ-4121TNR.
- Make sure you use the correct firmware version to set the PC bits.
Mode | Firmware Version |
TD-4650TNWBR / TD-4750TNWBR | V1.04.S21 or later |
TJ-4021TNR / TJ-4121TNR | B2.12.S27 or later |
rfid Read
Read data from the RFID tag and return the data after the print label function is called.
Declaration
intrfidRead(Stringunlock,Stringformat,StringblockNumber,StringdataSize,StringmemoryBank);
Parameters
Parameter | Type | Required | Description |
unlock |
string | Yes | Optional parameter to unlock the data so it can be overwritten later 0 : Read without unlocking 1 to FFFFFFFF in hex : Read and unlock the data block |
format |
string | Yes | Format of the field data A = ASCII H = Hex |
block Number |
string | Yes | Specifies 0 |
data Size |
string | Yes | Read data size from 1 to n in decimal numbers |
memory Bank |
string | Yes | Memory bank EPC – EPC area (Up to 496 bits) TID – Tag identification area USR – User area (Up to 8 kilobits) ACS – Access code area KIL – Kill code area PC – PC code area |
Return Value
integer; 1 if success, otherwise 0.
Supported Printers: TD-4650TNWBR, TD-4750TNWBR, TJ-4021TNR, and TJ-4121TNR.
rfid Get Read Data
Return the received tag data specified by the rfidRead
function. Make sure you set this command immediately after calling the print label
function.
Declaration
stringrfidGetReadData()
Parameters
None
Return Value
string; tag data.
Supported Printers: TD-4650TNWBR, TD-4750TNWBR, TJ-4021TNR, and TJ-4121TNR
usbport query printer
Return the printer status (USB port only).
For more information, see the <ESC>!? command in the FBPL Command Reference.
Declaration
stringusbportqueryprinter();
Parameters
None
Return Value
string; -1
if failure, otherwise a status code is returned.
Status Code (HEX) | Printer Status |
00 | Normal |
01 | Head opened |
02 | Paper Jam |
03 | Paper Jam and head opened |
04 | Out of paper |
05 | Out of paper and head opened |
08 | Out of ribbon |
09 | Out of ribbon and head opened |
0A | Out of ribbon and paper jam |
0B | Out of ribbon, paper jam and head opened |
0C | Out of ribbon and out of paper |
0D | Out of ribbon, out of paper and head opened |
10 | Pause |
20 | Printing |
80 | Other error |
netpor tquery printer
Return the printer status (wired LAN or wireless LAN only)
For more information, see the <ESC> !? command in the FBPL Command Reference.
Declaration
string netportqueryprinter();
Parameters
None
Return Value
string; -1
if failure, otherwise a status code is returned.
Status Code (HEX) | Printer Status |
00 | Normal |
01 | Head opened |
02 | Paper Jam |
03 | Paper Jam and head opened |
04 | Out of paper |
05 | Out of paper and head opened |
08 | Out of ribbon |
09 | Out of ribbon and head opened |
0A | Out of ribbon and paper jam |
0B | Out of ribbon, paper jam and head opened |
0C | Out of ribbon and out of paper |
0D | Out of ribbon, out of paper and head opened |
10 | Pause |
20 | Printing |
80 | Other error |
Sample Code
Example (1)
BROLIB_DLL.openport("Brother TD-4750TN");
BROLIB_DLL.setup("100", "63.5", "4", "8", "0", "0", "0");
BROLIB_DLL.clearbuffer();
BROLIB_DLL.barcode("100", "100", "128", "100", "1", "0", "2", "2", "Barcode Test");
BROLIB_DLL.printerfont("100", "250", "3", "0", "1", "1", "Print Font Test");
BROLIB_DLL.windowsfont(100, 300, 24, 0, 0, 0, "ARIAL", "Windows Arial Font Test");
BROLIB_DLL.downloadpcx("UL.PCX", "UL.PCX");
BROLIB_DLL.sendcommand("PUTPCX 100,400,\"UL.PCX\"");
BROLIB_DLL.printlabel("1", "1");
BROLIB_DLL.closeport();
Example (2)
BROLIB_DLL.openport("Brother TD-4750TN");
BROLIB_DLL.clearbuffer();
BROLIB_DLL.rfidWrite("0", "H", "0", "12", "EPC", "123456789012");
BROLIB_DLL.rfidRead("0", "H", "0", "12", "EPC");
BROLIB_DLL.printlabel("1", "1");
label2.Text = BROLIB_DLL.rfidGetReadData();
BROLIB_DLL.closeport();
About
Supported Printers
Release Notes
Documents / Resources
![]() |
brother Windows DLL Software Developer [pdf] User Guide Windows DLL Software Developer, DLL Software Developer, Software Developer, Developer |