分享 tsc 条码打印机 打印控件 调用方法 , c# silverlight
下载 TSCLIB.dll
或 网上搜索 TSCLIB.dll
复制到 windows\system 文件夹下
c#
public class tcsBasePrint
{
//[DllImport("TSCLib.dll")]
//public static extern int sendcommand(string command);//open connect port
//[DllImport("TSCLib.dll")]
//public static extern int openport(string port);//open connect port
//[DllImport("TSCLib.dll")]
//public static extern int closeport();//close connect port
//[DllImport("TSCLib.dll")]
///*
// width:列印宽度,单位mm
// height:列印长度,单位mm
// speed:列印速度 4.0 代表每秒4英寸速度
// density:列印浓度 0-15 越大表示浓度越高
// sensor:设定感测器类别 0 表示垂直感测器,1 表示黑标感测器
// vertical:设定间距高度
// pchar:设定偏移间距 0 参数一般设为0
// */
//public static extern int setup(string width, string height, string speed, string density, string sensor, string vertical, string pchar);
//[DllImport("TSCLib.dll")]
//public static extern int clearbuffer();//clear buffer
//[DllImport("TSCLib.dll")]
///*
// x:字串型別,條碼X 方向起始點,以點(point)表示。(200 DPI,1 點=1/8 mm, 300 DPI,1 點=1/12 mm)
// y:条码Y方向起始点
// codeType:条码类型(128,39,93等)
// height:代表条码的高度,,高度以点来表示
// readable:设定是否列印条码码文
// rotation:设定条码的旋转角度
// narrow:设定条码窄的比例因子
// wide:设定条码宽的比例因子
// code:条码内容
// pchar:设定偏移间距 0 参数一般设为0
// */
///*
// narrow : wide
// 1:1
// narrow : wide
// 1:2
// narrow : wide
// 1:3
// narrow : wide
// 2:5
// narrow : wide
// 3:7
// */
//public static extern int barcode(string x, string y, string codeType, string height, string readable, string rotation, string narrow, string wide, string code, string pchar);
//[DllImport("TSCLib.dll")]
///*
// x:文字X方向起始点
// y:文字Y方向起始点
// fontName:文字类型
// rotation:文字旋转角度
// xmul:设定文字X方向的放大倍率
// ymul:设定文字Y方向的放大倍率
// content:列印文字的内容
// */
//public static extern int printerfont(string x, string y, string fontName, string rotation, string xmul, string ymul, string content);
//[DllImport("TSCLib.dll")]
///*
// x:文字X方向起始点
// y:文字Y方向起始点
// fontHeight:字体高度
// rotation:文字旋转角度
// fontStyle:字体外形
// fontUnderline:底线
// faceName:字体名称
// content:列印内容
// */
//public static extern int windowsfont(int x, int y, int fontHeight, int rotation, int fontStyle, int fontUnderline, string faceName, string content);
//[DllImport("TSCLib.dll")]
///*
//打印设置
// a为式数
// b为份数
//*/
//public static extern int printlabel(string a, string b);
//[DllImport("TSCLib.dll")]
///*
// 设定打印后回卷
// */
//public static extern int formfeed();
//[DllImport("TSCLib.dll")]
///*
// 设定打印不后回卷
//*/
//public static extern int nobackfeed();
[DllImport("TSCLIB.dll")]
public static extern int about();
[DllImport("TSCLIB.dll", EntryPoint = "openport")]
public static extern int openport(string printername);
[DllImport("TSCLIB.dll", EntryPoint = "barcode")]
public static extern int barcode(string x, string y, string type, string height, string readable, string rotation, string narrow, string wide, string code);
[DllImport("TSCLIB.dll", EntryPoint = "clearbuffer")]
public static extern int clearbuffer();
[DllImport("TSCLIB.dll", EntryPoint = "closeport")]
public static extern int closeport();
[DllImport("TSCLIB.dll", EntryPoint = "downloadpcx")]
public static extern int downloadpcx(string filename, string image_name);
[DllImport("TSCLIB.dll", EntryPoint = "formfeed")]
public static extern int formfeed();
[DllImport("TSCLIB.dll", EntryPoint = "nobackfeed")]
public static extern int nobackfeed();
[DllImport("TSCLIB.dll", EntryPoint = "printerfont")]
public static extern int printerfont(string x, string y, string fonttype, string rotation, string xmul, string ymul, string text);
[DllImport("TSCLIB.dll", EntryPoint = "printlabel")]
public static extern int printlabel(string set, string copy);
[DllImport("TSCLIB.dll", EntryPoint = "sendcommand")]
public static extern int sendcommand(string printercommand);
[DllImport("TSCLIB.dll", EntryPoint = "setup")]
public static extern int setup(string width, string height, string speed, string density, string sensor, string vertical, string offset);
[DllImport("TSCLIB.dll", EntryPoint = "windowsfont")]
public static extern int windowsfont(int x, int y, int fontheight, int rotation, int fontstyle, int fontunderline, string szFaceName, string content);
}
调用:
return printobj.tcsBasePrint.about();