Skip to content
On this page

Interface: TsplLib

command

command: number[]

@description: command array

Defined in

interface/TsplLib.ts:9


encoding

encoding: string

@description: Encoding method, default utf-8

Defined in

interface/TsplLib.ts:5


getBuffer

getBuffer: () => ArrayBuffer

Type declaration

▸ (): ArrayBuffer

@description: Get print command (Buffer)

Returns

ArrayBuffer

Returns the print command (Buffer)

Defined in

interface/TsplLib.ts:261


getCommand

getCommand: () => number[]

Type declaration

▸ (): number[]

@description: get print command

Returns

number[]

return print command

Defined in

interface/TsplLib.ts:256


init

init: () => void

Type declaration

▸ (): void

@description: init the command

Returns

void

Defined in

interface/TsplLib.ts:16


setBackFeed

setBackFeed: (m: number) => void

Type declaration

▸ (m): void

@description: Pulls the label back the specified length

Parameters
NameTypeDescription
mnumber1≤n≤9999, unit dot
Returns

void

Defined in

interface/TsplLib.ts:138


setBackup

setBackup: (m: number) => void

Type declaration

▸ (m): void

@description: Pulls the label back the specified length

Parameters
NameTypeDescription
mnumber1≤n≤9999, unit dot
Returns

void

Defined in

interface/TsplLib.ts:143


setBar

setBar: (x: number, y: number, width: number, height: number) => void

Type declaration

▸ (x, y, width, height): void

@description: draw a line on the label

Parameters
NameTypeDescription
xnumberThe X coordinate of the upper left corner of the line, in dot
ynumberThe Y coordinate of the upper left corner of the line, in dot
widthnumberLine width, unit dot
heightnumberLine height, unit dot
Returns

void

Defined in

interface/TsplLib.ts:170


setBarCode

setBarCode: (x: number, y: number, codeType: string, height: number, humanReadable: 0 | 1, rotation: number, narrow: number, wide: number, content: string) => void

Type declaration

▸ (x, y, codeType, height, humanReadable, rotation, narrow, wide, content): void

@description: Draw 1D barcode

Parameters
NameTypeDescription
xnumberThe starting point of the horizontal coordinates of the upper left corner, expressed in dots
ynumberThe starting point of the vertical coordinate of the upper left corner, expressed in dots
codeTypestringBarcode type
heightnumberBarcode height, expressed in dots
humanReadable0 | 10 means invisible to human eyes, 1 means visible to human eyes
rotationnumberBarcode rotation angle, clockwise
narrownumberNarrow bar width, expressed in dots
widenumberWidth bar width, expressed in dots
contentstringBarcode content
Returns

void

Example

ts
setBarCode(10, 10, '39', 100, 1, 0, 2, 4, '123456789')

Defined in

interface/TsplLib.ts:185


setBitmap

setBitmap: (x: number, y: number, width: number, height: number, mode: number, bitmap: number[]) => void

Type declaration

▸ (x, y, width, height, mode, bitmap): void

@description: Draw a bitmap (non-BMP format image file)

Parameters
NameTypeDescription
xnumberThe X coordinate of the upper left corner of the bitmap
ynumberThe Y coordinate of the upper left corner of the bitmap
widthnumberWidth of bitmap, unit byte
heightnumberThe height of the bitmap, in dot
modenumberbitmap drawing mode 0 OVERWRITE 1 OR 2 XOR
bitmapnumber[]Image pixel value array
Returns

void

Defined in

interface/TsplLib.ts:58


setBline

setBline: (m: number, n: number) => void

Type declaration

▸ (m, n): void

@description: Set the height of the black mark and define the length of the label that is sent out after the label is printed

Parameters
NameTypeDescription
mnumberBlack mark height, unit (mm)
nnumberExtra output paper length, unit (mm)
Returns

void

Defined in

interface/TsplLib.ts:90


setBox

setBox: (x: number, y: number, xend: number, yend: number, thickness: number) => void

Type declaration

▸ (x, y, xend, yend, thickness): void

@description: Draw a rectangular box on the volume label

Parameters
NameTypeDescription
xnumberThe X coordinate of the upper left corner of the box, in dot
ynumberThe Y coordinate of the upper left corner of the box, in dot
xendnumberThe X coordinate of the lower right corner of the box, in dot
yendnumberThe Y coordinate of the lower right corner of the box, in dot
thicknessnumberBox line width, unit dot
Returns

void

Defined in

interface/TsplLib.ts:194


setCashBox

setCashBox: (m: 0 | 1, t1: number, t2: number) => void

Type declaration

▸ (m, t1, t2): void

@description: cash box control pulse

Parameters
NameTypeDescription
m0 | 10, 48 Pin 2 of the cash drawer socket 1, 49 Pin 5 of the cash drawer socket
t1number0≤t1≤255 Output the cash drawer open pulse set by t1 and t2 to the pin specified by m
t2number0≤t2≤255 Output the cash drawer open pulse set by t1 and t2 to the pin specified by m
Returns

void

Defined in

interface/TsplLib.ts:84


setCls

setCls: () => void

Type declaration

▸ (): void

@description: Clear the data of the image buffer

Returns

void

Defined in

interface/TsplLib.ts:47


setCodePage

setCodePage: (m: number) => void

Type declaration

▸ (m): void

@description: Select the corresponding international code page

Parameters
NameTypeDescription
mnumber8-bit codepage character set represents 437:United States 850:Multilingual 852:Slavic 860:Portuguese 863:Canadian/French 865:Nordic Windows code page 1250:Central Europe 1252:Latin I 1253:Greek 1254:Turkish Limited to 12×24 dot alphanumeric font WestEurope:WestEurope Greek:Greek Hebrew:Hebrew EastEurope:EastEurope Iran:Iran IranII:IranII Latvian:Latvian Arabic:Arabic Vietnam:Vietnam Uygur:Uygur Thai:Thai 1252:Latin I 1257:WPC1257 1251:WPC1251 866:Cyrillic 858:PC858 747:PC747 864:PC864 1001:PC1001
Returns

void

Defined in

interface/TsplLib.ts:128


setCommand

setCommand: (command: string | number[]) => void

Type declaration

▸ (command): void

@description: Set commands(If you want to set a custom directive, you can use the command)

Parameters
NameTypeDescription
commandstring | number[]command
Returns

void

Defined in

interface/TsplLib.ts:251


setCountry

setCountry: (m: number) => void

Type declaration

▸ (m): void

@description: Select the corresponding international character set

Parameters
NameTypeDescription
mnumber001:USA 002:French 003:Latin America 034:Spanish 039:Italian 044:United Kingdom 046:Swedish 047:Norwegian 049:German
Returns

void

Defined in

interface/TsplLib.ts:121


setDensity

setDensity: (m: number) => void

Type declaration

▸ (m): void

@description: Controlling Density When Printing

Parameters
NameTypeDescription
mnumber0~15 0: use the lightest printing density 15: use the darkest printing density
Returns

void

Defined in

interface/TsplLib.ts:105


setDirection

setDirection: (m: 0 | 1) => void

Type declaration

▸ (m): void

@description: Define the orientation of output paper and printed fonts when printing

Parameters
NameTypeDescription
m0 | 10 or 1
Returns

void

Defined in

interface/TsplLib.ts:110


setEncoding

setEncoding: (encoding: string) => void

Type declaration

▸ (encoding): void

@description: Set encoding type

Parameters
NameTypeDescription
encodingstringencoding type
Returns

void

Defined in

interface/TsplLib.ts:242


setErase

setErase: (x_start: number, y_start: number, x_width: number, y_height: number) => void

Type declaration

▸ (x_start, y_start, x_width, y_height): void

@description: Clear data in some areas of the image buffer

Parameters
NameTypeDescription
x_startnumberThe X coordinate of the upper left corner of the cleared area, unit dot
y_startnumberThe Y coordinate of the upper left corner of the cleared area, unit dot
x_widthnumberClear area width, unit dot
y_heightnumberClear area height, unit dot
Returns

void

Defined in

interface/TsplLib.ts:216


setFeed

setFeed: (m: number) => void

Type declaration

▸ (m): void

@description: Pushes the label stock forward by the specified length

Parameters
NameTypeDescription
mnumber1≤n≤9999, unit dot
Returns

void

Defined in

interface/TsplLib.ts:133


setFormFeed

setFormFeed: () => void

Type declaration

▸ (): void

@description: Control the printer to feed a label paper

Returns

void

Defined in

interface/TsplLib.ts:147


setGap

setGap: (m: number, n: number) => void

Type declaration

▸ (m, n): void

@description: Set the vertical distance between two label papers

Parameters
NameTypeDescription
mnumberVertical distance between two labels
nnumbervertical spacing offset
Returns

void

Defined in

interface/TsplLib.ts:42


setHome

setHome: () => void

Type declaration

▸ (): void

@description: When using label paper with gaps or black marks, if it is uncertain whether the first label paper is in the correct printing position, this command can push the label paper forward to the beginning of the next label paper to start printing. Label size and gap need to be set before this command;Paper height greater than or equal to 30 mm

Returns

void

Defined in

interface/TsplLib.ts:151


setLimitFeed

setLimitFeed: (m: number) => void

Type declaration

▸ (m): void

@description: When setting the printer to feed paper, if the vertical distance cannot be detected after the set length, the printer will generate an error and stop paper feeding.

Parameters
NameTypeDescription
mnumberunit mm
Returns

void

Defined in

interface/TsplLib.ts:162


setNewLine

setNewLine: () => void

Type declaration

▸ (): void

@description: Instruction wrapping, called by default, if not necessary, do not need to call

Returns

void

Defined in

interface/TsplLib.ts:246


setOffset

setOffset: (m: number) => void

Type declaration

▸ (m): void

@description: Control the stop position of each label in peel-off mode. When printing the next sheet, the printer will compensate the part that was pushed out more or less by pulling back. This command is only available in strip mode

Parameters
NameTypeDescription
mnumberpaper stop distance, unit (mm)
Returns

void

Defined in

interface/TsplLib.ts:95


setPrint

setPrint: (m?: number, n?: number) => void

Type declaration

▸ (m?, n?): void

@description: execute print

Parameters
NameTypeDescription
m?numberSpecify the number of copies to print;1≤m≤65535
n?numberThe number of sheets to be printed repeatedly per label;1≤n≤65535
Returns

void

Defined in

interface/TsplLib.ts:77


setPutBmp

setPutBmp: (x: number, y: number, fileName: string) => void

Type declaration

▸ (x, y, fileName): void

@description: Print monochrome BMP image files

Parameters
NameTypeDescription
xnumberThe coordinates of the starting point in the horizontal direction, expressed in dots
ynumberThe coordinates of the starting point in the vertical direction, expressed in dots
fileNamestringThe name of the file to be printed (need to be downloaded in the printer cache)
Returns

void

Defined in

interface/TsplLib.ts:201


setPutPcx

setPutPcx: (x: number, y: number, fileName: string) => void

Type declaration

▸ (x, y, fileName): void

@description: Print monochrome PCX format picture files

Parameters
NameTypeDescription
xnumberThe coordinates of the starting point in the horizontal direction, expressed in dots
ynumberThe coordinates of the starting point in the vertical direction, expressed in dots
fileNamestringThe name of the file to be printed (need to be downloaded in the printer cache)
Returns

void

Defined in

interface/TsplLib.ts:208


setQRCode

setQRCode: (x: number, y: number, ecc: string, cellWidth: number, mode: string, rotation: number, content: string) => void

Type declaration

▸ (x, y, ecc, cellWidth, mode, rotation, content): void

@description: This command is used to print the QR code

Parameters
NameTypeDescription
xnumberThe coordinates of the starting point in the horizontal direction of the QR code
ynumberThe coordinates of the starting point in the vertical direction of the QR code
eccstringSelect QRCODE Error Correction Level:L 7% M 15% Q 25% H 30%
cellWidthnumberQR code width 1-10
modestringmanual/automatic coding:A Auto M Manual
rotationnumberRotation angle (clockwise):0 0 degrees 90 90 degrees 180 180 degrees 270 270 degrees
contentstringQR code content
Returns

void

Example

ts
setQRCode(10, 10, 'L', 5, 'A', 0, '123456789')

Defined in

interface/TsplLib.ts:236


setReference

setReference: (x: number, y: number) => void

Type declaration

▸ (x, y): void

@description: Define the reference coordinate origin of the label

Parameters
NameTypeDescription
xnumberThe coordinate position in the horizontal direction, unit dot
ynumberCoordinate position in the vertical direction, unit dot
Returns

void

Defined in

interface/TsplLib.ts:116


setReverse

setReverse: (x_start: number, y_start: number, x_width: number, y_height: number) => void

Type declaration

▸ (x_start, y_start, x_width, y_height): void

@description: Print the specified area in reverse

Parameters
NameTypeDescription
x_startnumberThe X coordinate of the upper left corner of the reverse area, unit dot
y_startnumberThe Y coordinate of the upper left corner of the reverse area, unit dot
x_widthnumberReverse area width, unit dot
y_heightnumberReverse area height, unit dot
Returns

void

Defined in

interface/TsplLib.ts:224


setSize

setSize: (width: number, height: number) => void

Type declaration

▸ (width, height): void

@description: Set the width and length of the label paper

Parameters
NameTypeDescription
widthnumberWidth of label paper (without backing paper)
heightnumberHeight of label paper (without backing paper)
Returns

void

Defined in

interface/TsplLib.ts:35


setSound

setSound: (m: number, n: number) => void

Type declaration

▸ (m, n): void

@description: This command is used to control the frequency of the buzzer, and 10 levels of sound can be set, and the length of each level of sound is controlled by the second parameter

Parameters
NameTypeDescription
mnumberScale: 0-9
nnumberInterval time: 1-4095
Returns

void

Defined in

interface/TsplLib.ts:157


setSpeed

setSpeed: (m: number) => void

Type declaration

▸ (m): void

@description: Control print speed

Parameters
NameTypeDescription
mnumberset print speed(For example: 2.0 sets the printing speed to 2.0”/sec)
Returns

void

Defined in

interface/TsplLib.ts:100


setText

setText: (x: number, y: number, font: string, rotation: number, x_multiplication: number, y_multiplication: number, text: string) => void

Type declaration

▸ (x, y, font, rotation, x_multiplication, y_multiplication, text): void

@description: string msg

Parameters
NameTypeDescription
xnumberThe coordinates of the starting point of the text in the X direction
ynumberThe coordinates of the starting point of the text in the Y direction
fontstring1 8×12 dot Alphanumeric Font 2 12×20 dot Alphanumeric Font 3 16×24 dot Alphanumeric Font 4 24×32 dot Alphanumeric Font 5 32×48 dot Alphanumeric Font 6 14×19 dot Alphanumeric Font OCR- B 7 21×27 dot Alphanumeric font OCR-B 8 14×25 dot Alphanumeric font OCR-A 9 9×17 dot Alphanumeric font 10 12×24 dot Alphanumeric font TST24.BF2 Traditional Chinese 24×24Font (big five code) TSS24.BF2 Simplified Chinese 24×24Font (GB code) K Korean 24×24Font (KS code) rotation Text rotation angle (clockwise) 0 0 degrees 90 90 degrees 180 180 degrees 270 270 degrees
rotationnumberText rotation angle (clockwise)
x_multiplicationnumberX direction magnification 1-10
y_multiplicationnumberY direction magnification 1-10
textstring
Returns

void

Defined in

interface/TsplLib.ts:70


stringToCharCodeArray

stringToCharCodeArray: (str: string) => number[]

Type declaration

▸ (str): number[]

@description: string to charCode array

Parameters
NameTypeDescription
strstringstring data
Returns

number[]

charCode array

Defined in

interface/TsplLib.ts:22


stringToEncodedBytes

stringToEncodedBytes: (str: string) => number[]

Type declaration

▸ (str): number[]

@description: string to encoded bytes

Parameters
NameTypeDescription
strstringstring data
Returns

number[]

Defined in

interface/TsplLib.ts:28