TSCLIB.DLL 函式庫使用說明 請於使用 TSCLIB.DLL 前, 安裝條碼印表機驅動程式 1. openport(a) 說明 : 指定電腦端的輸出埠參數 : a: 字串型別 (1) 單機列印時, 請指定印表機驅動程式名稱例如 : TSC CLEVER TTP-243 (2) 若連接印表機伺服器, 請指定伺服器路徑及共用印表機名稱例如 : \\SERVER\TTP243 (3) 直接指定平行傳輸介面, 請指定輸出埠名稱為 LPT1 到 LPT4 (4) 直接指定 USB 傳輸介面, 請指定輸出埠名稱為 USB 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 吋列印速度 6.0: 每秒 6.0 吋列印速度 8.0: 每秒 8.0 吋列印速度 10.0: 每秒 10.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: 字串型別, 設定是否列印條碼碼文 0: 不列印碼文 1: 列印碼文 f: 字串型別, 設定條碼旋轉角度 0: 旋轉 0 度 90: 旋轉 90 度 180: 旋轉 180 度 270: 旋轉 270 度 g: 字串型別, 設定條碼窄 bar 比例因子, 請參考 TSPL 使用手冊 h: 字串型別, 設定條碼窄 bar 比例因子, 請參考 TSPL 使用手冊 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: 字串型別, 內建字型名稱, 共 12 種 1: 8*/12 dots 2: 12*20 dots 3: 16*24 dots 4: 24*32 dots 5: 32*48 dots TST24.BF2: 繁體中文 24*24 TST16.BF2: 繁體中文 16*16 TTT24.BF2: 繁體中文 24*24 ( 電信碼 ) TSS24.BF2: 簡體中文 24*24 TSS16.BF2: 簡體中文 16*16
K: 韓文 24*24 L: 韓文 16*16 d: 字串型別, 設定文字旋轉角度 0: 旋轉 0 度 90: 旋轉 90 度 180: 旋轉 180 度 270: 旋轉 270 度 e: 字串型別, 設定文字 X 方向放大倍率,1~8 f: 字串型別, 設定文字 X 方向放大倍率,1~8 g: 字串型別, 列印文字內容 7. sendcommand(command) 說明 : 送內建指令到條碼印表機參數 : 詳細指令請參考 TSPL 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 CLEVER TTP-243 ) Call openport( \\server\ttp243 ) 開啟網路印表機 Call openport( LPT1 ) 直接開啟 LPT1 傳輸埠 Call openport( USB ) 直接開啟 USB 傳輸埠 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 CLEVER TTP-243 ) 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 ; 請注意 : 函數名稱務必使用小寫字母