TSCLIB.DLL 函数库使用说明
请在使用TSCLIB.DLL 前,安装条形码打印机驱动程序。
1. openport(a)
说明: 指定计算机端的输出端口
参数:
a: 单机打印时,请指定打印机驱动程序名称,例如: TSC TDP-245
若连接打印机服务器,请指定服务器路径及共享打印机名称,例如:
\\SERVER\ TSC TDP-245
2. closeport()
说明: 关闭指定的计算机端输出端口
参数: 无
3. setup(a,b,c,d,e,f,g)
说明: 设定标签的宽度、高度、打印速度、打印浓度、传感器类别、gap/black mark
垂直间距、gap/black mark 偏移距离)
参数:
a: 字符串型别,设定标签宽度,单位 mm
b: 字符串型别,设定标签高度,单位 mm
c: 字符串型别,设定打印速度,(打印速度随机型不同而有不同的选项)
1.0: 每秒1.0 英寸打印速度
1.5: 每秒1.5 英寸打印速度
2.0: 每秒2.0 英寸打印速度
3.0: 每秒3.0 英寸打印速度
4.0: 每秒4.0 英寸打印速度
5.0: 每秒5.0 英寸打印速度
6.0: 每秒6.0 英寸打印速度
d: 字符串型别,设定打印浓度,
0~15,数字越大打印结果越黑
e: 字符串型别,设定使用传感器类别
0 表示使用垂直间距传感器(gap sensor)
1 表示使用黑标传感器(black mark sensor)
f: 字符串型别,设定gap/black mark 垂直间距高度,单位: mm
g: 字符串型别,设定gap/black mark 偏移距离,单位: mm,此参数若使用一般标签
时均设为0
4. clearbuffer()
说明: 清除
参数: 无
5. barcode(a,b,c,d,e,f,g,h,I)
说明: 使用条形码机内建条形码打印
参数:
a: 字符串型别,条形码X 方向起始点,以点(point)表示。
(200 DPI,1 点=1/8 mm, 300 DPI,1 点=1/12 mm)
b: 字符串型别,条形码Y 方向起始点,以点(point)表示。
(200 DPI,1 点=1/8 mm, 300 DPI,1 点=1/12 mm)
c: 字符串型别,
128 Code 128, switching code subset A, B, C automatically
128M Code 128, switching code subset A, B, C manually.
EAN128 Code 128, switching code subset A, B, C automatically
25 Interleaved 2 of 5
25C Interleaved 2 of 5 with check digits
39 Code 39
39C Code 39 with check digits
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
POST Postnet
UPCA UPC-A
UPCA+2 UPC-A with 2 digits add-on
UPCA+5 UPC-A with 5 digits add-on
UPCE UPC-E
UPCE+2 UPC-E with 2 digits add-on
UPCE+5 UPC-E with 5 digits add-on
d: 字符串型别,设定条形码高度,高度以点来表示
e: 字符串型别,设定是否打印条形码码文
f: 字符串型别,设定条形码旋转角度
0: 不打印码文
1: 打印码文
0: 旋转0 度
90: 旋转90 度
180: 旋转180 度
270: 旋转270 度
g: 字符串型别,设定条形码窄bar 比例因子,请参考 编程手册
h: 字符串型别,设定条形码窄bar 比例因子,请参考 编程手册
I: 字符串型别,条形码内容
6. printerfont(a,b,c,d,e,f,g)
说明: 使用条形码机内建文字打印
参数:
a: 字符串型别,文字X 方向起始点,以点(point)表示。
(200 DPI,1 点=1/8 mm, 300 DPI,1 点=1/12 mm)
b: 字符串型别,文字Y 方向起始点,以点(point)表示。
(200 DPI,1 点=1/8 mm, 300 DPI,1 点=1/12 mm)
c: 字符串型别,内建字型名称,共8 种。
1: 8*/12 dots
2: 12*20 dots
3: 16*24 dots
4: 24*32 dots
5: 32*48 dots
TST24.BF2: 繁体中文24*24
TSS24.BF2: 简体中文24*24
K: 韩文 24*24
d: 字符串型别,设定文字旋转角度
0: 旋转0 度
90: 旋转90 度
180: 旋转180 度
270: 旋转270 度
e: 字符串型别,设定文字X 方向放大倍数,1~8
f: 字符串型别,设定文字X 方向放大倍数,1~8
g: 字符串型别,打印文字内容
7. sendcommand(command)
说明: 送内建指令到条形码打印机
参数: 详细指令请参考编程手册
8. printlabel(a,b)
说明: 打印标签内容
参数:
a: 字符串型别,设定打印标签个数(set)
b: 字符串型别,设定打印标签份数(copy)
9. downloadpcx(a,b)
说明:下载单色PCX 格式图文件至打印机
参数:
a: 字符串型别,文件名(可包含路径)
b: 字符串型别,下载至打印机内存内之文件名(请使用大写文件名)
10. formfeed()
说明: 跳页,该函数需在setup 后使用
参数: 无
11. nobackfeed()
说明: 设定纸张不回吐
参数: 无
12. windowsfont(a,b,c,d,e,f,g,h)
说明: 使用Windows TTF 字型打印文字
参数:
a: 整数型别,文字X 方向起始点,以点(point)表示。
b: 整数型别,文字Y 方向起始点,以点(point)表示。
c: 整数型别,字体高度,以点(point)表示。
d: 整数型别,旋转角度,逆时钟方向旋转
0 -> 0 degree
90-> 90 degree
180-> 180 degree
270-> 270 degree
e: 整数型别,字体外形
0-> 标准(Normal)
1-> 斜体(Italic)
2-> 粗体(Bold)
3-> 粗斜体(Bold and Italic)
f: 整数型别, 底线
0-> 无底线
1-> 加底线
g: 字符串型别,字体名称。如: Arial, Times new Roman, 细名体, 标楷体
h: 字符串型别,打印文字内容。
13. about()
说明: 显示DLL 版本号码
参数: 无
Visual Basic 5.0, 6.0 for Win95, 98 范例
Private Declare Sub openport Lib "c:\windows\system\tsclib.dll" (
ByVal PrinterName As String)
Private Declare Sub closeport Lib "c:\windows\system\tsclib.dll" ()
Private Declare Sub sendcommand Lib "c:\windows\system\tsclib.dll" ( _
ByVal command As String)
Private Declare Sub setup Lib "c:\windows\system\tsclib.dll" ( _
ByVal LabelWidth As String, _
ByVal LabelHeight As String, _
ByVal Speed As String, _
ByVal Density As String, _
ByVal Sensor As String, _
ByVal Vertical As String, _
ByVal Offset As String)
Private Declare Sub downloadpcx Lib "c:\windows\system\tsclib.dll" ( _
ByVal Filename As String, _
ByVal ImageName As String)
Private Declare Sub barcode Lib "c:\windows\system\tsclib.dll" ( _
ByVal X As String, _
ByVal Y As String, _
ByVal CodeType As String, _
ByVal Height As String, _
ByVal Readable As String, _
ByVal rotation As String, _
ByVal Narrow As String, _
ByVal Wide As String, _
ByVal Code As String)
Private Declare Sub printerfont Lib "c:\windows\system\tsclib.dll" ( _
ByVal X As String, _
ByVal Y As String, _
ByVal FontName As String, _
ByVal rotation As String, _
ByVal Xmul As String, _
ByVal Ymul As String, _
ByVal Content As String)
Private Declare Sub clearbuffer Lib "c:\windows\system\tsclib.dll" ()
Private Declare Sub printlabel Lib "c:\windows\system\tsclib.dll" ( _
ByVal NumberOfSet As String, _
ByVal NumberOfCopy As String)
Private Declare Sub formfeed Lib "c:\windows\system\tsclib.dll" ()
Private Declare Sub nobackfeed Lib "c:\windows\system\tsclib.dll" ()
Private Declare Sub windowsfont Lib "c:\windows\system\tsclib.dll" ( _
ByVal X As Integer, _
ByVal Y As Integer, _
ByVal fontheight As Integer, _
ByVal rotation As Integer, _
ByVal fontstyle As Integer, _
ByVal fontunderline As Integer, _
ByVal FaceName As String, _
ByVal TextContent As String)
Private Sub Command1_Click()
Call openport(“TSC TDP-245”)
‘Call openport(“\\server\TSC TDP-245”)
Call setup("100", "100", "3", "10", "0", "0", "0")
Call clearbuffer
Call downloadpcx("c:\UL.PCX", "UL.PCX")
Call printerfont("10", "10", "4", "0", "1", "1", "TEST PRINTOUT")
Call barcode("10", "80", "39", "96", "1", "0", "2", "4", "0987654321")
Call sendcommand("PUTPCX 100,250,""UL.PCX""")
Call sendcommand("BAR 400,200,300,100")
Call sendcommand("BOX 10,300,300,300,5")
Call windowsfont(10, 500, 80, 0, 0,0, "标楷体", "标楷体字型")
Call printlabel("1", "1")
Call closeport
End Sub
FoxPro 范例
declare openport in c:\windows\system\tsclib.dll string
declare closeport in c:\windows\system\tsclib.dll
declare sendcommand in c:\windows\system\tsclib.dll
declare setup in c:\windows\system\tsclib.dll
string,string,string,string,string,string,string
declare downloadpcx in c:\windows\system\tsclib.dll
string, string
declare barcode in c:\windows\system\tsclib.dll
string,string,string,string,string,string,string,string,string
declare printerfont in c:\windows\system\tsclib.dll
string,string,string,string,string,string,string
declare clearbuffer in c:\windows\system\tsclib.dll
declare printlabel in c:\windows\system\tsclib.dll string,string
declare formfeed in c:\windows\system\tsclib.dll
declare nobackfeed in c:\windows\system\tsclib.dll
declare windowsfont in c:\windows\system\tsclib.dll
integer,integer,integer,integer,integer,integer,integer,string,string
openport(“TSC TDP-245”)
setup("32","25","2","10","0","0","0")
clearbuffer()
barcode("10","0","EAN13","80","1","0","2","4","123456789012")
windowsfont(10,100,50,0,0,0,"标楷体","标楷体字型")
printlabel("1","1")
closeport()
Delphi 范例
procedure openport(PrinterName:pchar);stdcall;far; external ‘tsclib.dll’;
procedure closeport; external ‘tsclib.dll’;
procedure sendcommand(Command:pchar);stdcall;far;external ‘tsclib.dll’;
procedure setup(LabelWidth, LabelHeight, Speed, Density, Sensor, Vertical,
Offset:pchar);tsdcall; far; external ‘tsclib.dll’;
procedure downloadpcx(Filename,ImageName:pchar);stdcall;far;
external ‘tsclib.dll’;
procedure barcode(X, Y, CodeType, Height, Readable, Rotation, Narrow,
Wide, Code :pchar); stdcall; far; external ‘tsclib.dll’;
procedure printerfont(X, Y, FontName, Rotation, Xmul, Ymul, Content:pchar);
stdcall;far; external ‘tsclib.dll’;
procedure clearbuffer; external ‘tsclib.dll’;
procedure printlabel(NumberOfSet, NumberOfCopoy:pchar);stdcall; far;
external ‘tsclib.dll’;
procedure formfeed;external ‘tsclib.dll’;
procedure nobackfeed; external ‘tsclib.dll’
procedure windowsfont (X, Y, FontHeight, Rotation, FontStyle,
FontUnderline : integer; FaceName,
TextContect:pchar);stdcall;far;external ‘tsclib.dll’;
请注意: 函数名称务必使用小写字母
TSCLIB.DLL 函数库使用说明
请在使用TSCLIB.DLL 前,安装条形码打印机驱动程序。
1. openport(a)
说明: 指定计算机端的输出端口
参数:
a: 单机打印时,请指定打印机驱动程序名称,例如: TSC TDP-245
若连接打印机服务器,请指定服务器路径及共享打印机名称,例如:
\\SERVER\ TSC TDP-245
2. closeport()
说明: 关闭指定的计算机端输出端口
参数: 无
3. setup(a,b,c,d,e,f,g)
说明: 设定标签的宽度、高度、打印速度、打印浓度、传感器类别、gap/black mark
垂直间距、gap/black mark 偏移距离)
参数:
a: 字符串型别,设定标签宽度,单位 mm
b: 字符串型别,设定标签高度,单位 mm
c: 字符串型别,设定打印速度,(打印速度随机型不同而有不同的选项)
1.0: 每秒1.0 英寸打印速度
1.5: 每秒1.5 英寸打印速度
2.0: 每秒2.0 英寸打印速度
3.0: 每秒3.0 英寸打印速度
4.0: 每秒4.0 英寸打印速度
5.0: 每秒5.0 英寸打印速度
6.0: 每秒6.0 英寸打印速度
d: 字符串型别,设定打印浓度,
0~15,数字越大打印结果越黑
e: 字符串型别,设定使用传感器类别
0 表示使用垂直间距传感器(gap sensor)
1 表示使用黑标传感器(black mark sensor)
f: 字符串型别,设定gap/black mark 垂直间距高度,单位: mm
g: 字符串型别,设定gap/black mark 偏移距离,单位: mm,此参数若使用一般标签
时均设为0
4. clearbuffer()
说明: 清除
参数: 无