Skip to content

TSPL Commands

TSPL (TSC Printer Language) is a label printer command language developed by TSC and widely used for label and barcode printing.

Like CPCL, TSPL is a text-based command language. The main difference is that TSPL separates parameters with commas.

FeatureCPCLTSPL
Parameter separatorsSpacesCommas
StringsDouble quotesDouble quotes
Unitsdotmm or dot

Set the label width and height.

SIZE width mm,height mm
SIZE width mm,height mm,copies
ParameterDescriptionUnits
WidthLabel widthmm
HeightLabel heightmm
CopiesNumber of copies (optional)-

Example:

SIZE 60 mm,40 mm
SIZE 80 mm,50 mm,2

Set the gap between two labels.

GAP gap_height mm,offset mm
ParameterDescriptionUnits
Gap heightLabel gap heightmm
OffsetVertical offsetmm

Example:

GAP 3 mm,0

Enable black mark paper mode.

BLINE height mm,offset mm

Enable continuous paper mode (without gaps).

CONTINUOUS

Enable label paper printing mode.

LABEL

Set the print direction and mirroring.

DIRECTION direction,mirror
ParameterValueDescription
Direction0Forward feed
Direction1Reverse feed
Mirror0No mirroring
Mirror1Mirrored printing

Example:

DIRECTION 1,0

Clear the image buffer.

CLS

Set the print density.

DENSITY density_value
ParameterRangeDescription
Density value0-150 = lightest, 15 = darkest

Example:

DENSITY 8

Set the print speed.

SPEED speed_value
ParameterRangeDescription
Speed value1-63–4 recommended

Example:

SPEED 4

Set the coordinate origin offset.

REFERENCE horizontal_offset,vertical_offset

Example:

REFERENCE 10,10

Set the paper feed offset.

OFFSET offset mm

Set the vertical offset of the printed content.

SHIFT offset

Print text content.

TEXT X,Y,"font",rotation,Xscale,Yscale,"content"
TEXT X,Y,"font",rotation,Xscale,Yscale,alignment,"content"
ParameterDescription
XText starting X coordinate (dot)
YText starting Y coordinate (dot)
FontFont name
RotationRotation angle (0/90/180/270)
X multiplierHorizontal multiplier (1-8)
Y multiplierVertical multiplier (1-8)
AlignmentAlignment (optional)
ContentText to print
Font name-dot matrix sizeDescription
TSS12.BF21212-dot matrix font
TSS16.BF21616-dot matrix font
TSS20.BF22020-dot matrix font
TSS24.BF22424-dot matrix font (recommended)
TSS28.BF22828-dot matrix font
TSS32.BF23232-dot matrix font
1-8x12 Latin font
2-12x20 Latin font
3-16x24 Latin font
4-24x32 Latin font
5-32x48 Latin font
ValueAngle
00°
9090°
180180°
270270°
ValueDescription
0Default (Left aligned)
1Left aligned
2Centered
3Right aligned

Example:

TEXT 50,50,"TSS24.BF2",0,1,1,"产品名称"
TEXT 50,100,"TSS24.BF2",0,2,2,"放大两倍"
TEXT 50,200,"3",0,1,1,"English Text"
TEXT 50,250,"TSS24.BF2",0,1,1,2,"居中文本"

Append B1 after the font parameter to enable bold text.

TEXT X,Y,"font",rotation,Xscale,Yscale,B1,"content"

Print a paragraph with automatic line wrapping.

BLOCK X,Y,width,height,"font",rotation,Xscale,Yscale,"content"
ParameterDescription
WidthText box width
HeightText box height

Example:

BLOCK 50,50,400,200,"TSS24.BF2",0,1,1,"这是一段很长的文本,会自动换行显示在文本框内。"

Print a one-dimensional barcode.

BARCODE X,Y,"type",height,human_readable,rotation,narrow_bar,wide_bar,"content"
ParameterDescription
XBarcode starting X coordinate
YBarcode starting Y coordinate
TypeBarcode type
HeightBarcode height (dot)
Human-readableShow human-readable text (0=Hide, 1=Show)
RotationRotation angle (0/90/180/270)
Narrow barNarrow bar width (1-10)
Wide barWide bar width (narrow bar × ratio)
ContentBarcode data
TypeDescription
128Code 128 (recommended)
128MCode 128 Subset
39Code 39
93Code 93
ITFInterleaved 2 of 5
UPCAUPC-A
UPCEUPC-E
EAN8EAN-8
EAN13EAN-13
CODABARCodabar
POSTPostnet
CPOSTChina Post

Example:

BARCODE 50,200,"128",80,1,0,2,4,"ABC123456"
BARCODE 50,350,"EAN13",60,1,0,2,4,"6901234567890"

Print a QR code.

QRCODE X,Y,error_correction_level,cell_width,mode,rotation,M2,S7,"content"
ParameterDescription
XQR code starting X coordinate
YQR code starting Y coordinate
Error correction levelL/M/Q/H
Cell widthCell width (1-10)
ModeA=Automatic
RotationRotation angle (0/90/180/270)
LevelError correction capacity
L7%
M15%
Q25%
H30%

Example:

QRCODE 300,50,H,4,A,0,M2,S7,"https://example.com"
QRCODE 50,50,M,6,A,0,"产品编号:12345"

Print a DataMatrix code.

DMATRIX X,Y,width,height,mode,"content"

Example:

DMATRIX 50,50,400,400,x8,"DataMatrix Content"

Draw a filled rectangle (horizontal or vertical lines only).

BAR X,Y,width,height
ParameterDescription
XTop-left X coordinate
YTop-left Y coordinate
WidthRectangle width
HeightRectangle height

Example:

BAR 30,100,420,2
BAR 50,50,200,100

Draw a rectangular outline.

BOX X,Y,X_end,Y_end,line_width
BOX X,Y,X_end,Y_end,line_width,rounded_corners
ParameterDescription
XTop-left X coordinate
YTop-left Y coordinate
X_endBottom-right X coordinate
Y_endBottom-right Y coordinate
Line widthBorder line width
Rounded cornersCorner radius (optional)

Example:

BOX 20,20,500,400,2
BOX 50,50,300,200,3,10

Draw a diagonal line.

DIAGONAL X,Y,X_end,Y_end,line_width

Draw a straight line, including diagonal lines.

LINE X,Y,X_end,Y_end,line_width

Example:

LINE 50,50,300,200,2

Draw a circle.

CIRCLE X,Y,diameter,line_width
ParameterDescription
XCenter X coordinate
YCenter Y coordinate
DiameterCircle diameter
Line widthBorder line width

Example:

CIRCLE 200,200,100,2

Draw an ellipse.

ELLIPSE X,Y,width,height,line_width

Example:

ELLIPSE 200,200,150,80,2

Invert the specified area.

REVERSE X,Y,width,height

Example:

REVERSE 50,50,200,100

Print a bitmap image.

BITMAP X,Y,width,height,mode,data
DOWNLOAD "filename",data_size,data
PUTBMP X,Y,"filename"

<ESC>!?
~!T
~!B
~!F
~!I
~!@
~!C

Set the automatic shutdown timeout.

SET AUTOOFF time
ParameterDescription
TimeShutdown timeout (minutes), 0 disables automatic shutdown

Set thermal transfer or direct thermal mode.

SET RIBBON ON
SET RIBBON OFF
SetDescription
ONThermal transfer mode (uses ribbon)
OFFDirect thermal mode

Set tear-off mode.

SET TEAR ON
SET TEAR OFF

Set peel-off mode.

SET PEEL ON
SET PEEL OFF

Set cutter mode.

SET CUTTER ON
SET CUTTER OFF

Set the printer’s character encoding.

CODEPAGE GBK
CODEPAGE UTF-8

Automatically detect the paper type and label gaps.

DETECT

Execute the print job.

PRINT copies,labels_per_copy
PRINT copies
ParameterDescription
CopiesNumber of copies
Labels per copyNumber of labels per copy (optional, default 1)

Example:

PRINT 1
PRINT 3,2

Print the printer’s self-test page.

SELFTEST

SIZE 60 mm,40 mm
GAP 3 mm,0
DIRECTION 1,0
DENSITY 8
SPEED 4
CLS
TEXT 180,30,"TSS24.BF2",0,2,2,"商品标签"
BAR 30,80,420,2
TEXT 30,100,"TSS24.BF2",0,1,1,"品名: 有机苹果"
TEXT 30,140,"TSS24.BF2",0,1,1,"规格: 500g/袋"
TEXT 30,180,"TSS24.BF2",0,1,1,"产地: 山东烟台"
TEXT 30,220,"TSS24.BF2",0,1,1,B1,"价格: ¥25.90"
BARCODE 80,270,"128",60,1,0,2,4,"6901234567890"
QRCODE 380,100,M,4,A,0,"https://example.com/product"
PRINT 1
SIZE 100 mm,150 mm
GAP 3 mm,0
DIRECTION 1,0
CLS
BOX 20,20,780,1180,3
TEXT 300,40,"TSS24.BF2",0,2,2,"快递单"
BAR 20,100,760,3
TEXT 40,130,"TSS24.BF2",0,1,1,"寄件人: 张三"
TEXT 40,170,"TSS24.BF2",0,1,1,"电话: 138****1234"
TEXT 40,210,"TSS24.BF2",0,1,1,"地址: 上海市浦东新区张江高科"
BAR 20,260,760,2
TEXT 40,290,"TSS24.BF2",0,1,1,"收件人: 李四"
TEXT 40,330,"TSS24.BF2",0,1,1,"电话: 139****5678"
BLOCK 40,370,700,120,"TSS24.BF2",0,1,1,"地址: 北京市朝阳区望京SOHO T3 25层"
BAR 20,500,760,3
BARCODE 150,550,"128",100,1,0,3,6,"SF1234567890123"
TEXT 280,680,"TSS24.BF2",0,1,1,"SF1234567890123"
QRCODE 300,750,H,8,A,0,"SF1234567890123"
TEXT 280,1000,"TSS24.BF2",0,1,1,"扫码查询物流"
PRINT 1
SIZE 70 mm,30 mm
GAP 2 mm,0
DIRECTION 1,0
DENSITY 10
CLS
BOX 10,10,550,230,2,15
TEXT 30,30,"TSS24.BF2",0,1,1,"资产编号:"
TEXT 180,30,"TSS24.BF2",0,1,1,B1,"IT-2024-001234"
BAR 30,70,500,1
TEXT 30,90,"TSS24.BF2",0,1,1,"设备名称: MacBook Pro"
TEXT 30,130,"TSS24.BF2",0,1,1,"使用部门: 技术研发部"
QRCODE 420,80,M,3,A,0,"IT-2024-001234"
PRINT 1

To use TSPL commands in an application, see the SDK guide for your language:

Complete TSPL command reference (PDF)