private void button1_Click(object sender, EventArgs e) { PrintLab.OpenPort("ZMIN X1"); //打开打印机端口,打印机驱动的名称一定要正确 PrintLab.ZM_ClearBuffer(); //清空缓冲区 PrintLab.ZM_SetPrintSpeed(4); //设置打印速度,4是4英寸/秒,6是6英寸/秒(X1最高是6,X1i最高是4) PrintLab.ZM_SetDarkness(10); //设置打印黑度(也是打印温度,最高是20,一般蜡质碳带设置为10,混合基碳带设置为12,树脂基碳带设置为18) PrintLab.ZM_SetLabelHeight(200, 16); //设置标签的高度和标签之间的行间隙,里面的数值是像素值(200dpi是8点/毫米,300dpi是11.8点/毫米,如果计算出小数需取整) PrintLab.ZM_SetLabelWidth(800); //设置标签的宽度 PrintByType(1); // 开始打印 PrintLab.ZM_PrintLabel(1, 1);//number:打印标签的数量,cpnumber:每张标签的复制份数 //关闭打印机端口 PrintLab.ClosePort(); PrintLab.OpenPort("ZMIN X1"); //打开打印机端口,打印机驱动的名称一定要正确 PrintLab.ZM_ClearBuffer(); //清空缓冲区 PrintLab.ZM_SetPrintSpeed(4); //设置打印速度,4是4英寸/秒,6是6英寸/秒(X1最高是6,X1i最高是4) PrintLab.ZM_SetDarkness(10); //设置打印黑度(也是打印温度,最高是20,一般蜡质碳带设置为10,混合基碳带设置为12,树脂基碳带设置为18) PrintLab.ZM_SetLabelHeight(200, 16); //设置标签的高度和标签之间的行间隙,里面的数值是像素值(200dpi是8点/毫米,300dpi是11.8点/毫米,如果计算出小数需取整) PrintLab.ZM_SetLabelWidth(800); //设置标签的宽度 PrintByType(2); // 开始打印 PrintLab.ZM_PrintLabel(1, 1);//number:打印标签的数量,cpnumber:每张标签的复制份数 //关闭打印机端口 PrintLab.ClosePort(); }
/// <summary> /// 服装小箱号信息打印 /// </summary> public void smallBoxPrint(object printObject) { PrintLab.OpenPort("POSTEK G-3106"); //打开打印机端口 PrintLab.PTK_SetPrintSpeed(4); //设置打印速度 PrintLab.PTK_SetDarkness(10); //设置打印黑度 PrintLab.PTK_SetLabelHeight(345, 15, 0, false); //设置标签的高度和定位间隙\黑线\穿孔的高度 PrintLab.PTK_SetLabelWidth(1252); //设置标签的宽度 PrintLab.PTK_SetDarkness(0); //清空缓冲区 PrintLab.PTK_ClearBuffer(); DataTable tbl = (DataTable)printObject; string strMasterCTN = ""; string strSmallCTN = ""; string strOrderNo = ""; string strDestination = ""; string strCountry = ""; string strShopName = ""; string strPackageStatus = ""; string strPackageUser = ""; string strPackageDate = ""; foreach (DataRow dr in tbl.Rows) { //Console.WriteLine(dr["SmallCTN"].ToString() + "///" + dr["Destination"].ToString() ); //strMasterCTN = dr["MasterCTN"].ToString(); strSmallCTN = dr["SmallCTN"].ToString(); //strOrderNo = dr["OrderNo"].ToString(); strDestination = dr["Destination"].ToString(); //strCountry = dr["Country"].ToString(); //strShopName = dr["ShopName"].ToString(); //strPackageStatus = dr["PackageStatus"].ToString(); //strPackageUser = dr["PackageUser"].ToString(); //strPackageDate = dr["PackageDate"].ToString(); if (!strSmallCTN.Equals("")) { PrintLab.PTK_DrawTextTrueTypeW(50, 10, 50, 0, "Arial", 1, 100, false, false, false, "A1", "S.CTN NO : "); PrintLab.PTK_DrawTextTrueTypeW(50, 80, 72, 0, "Arial", 1, 90, false, false, false, "A2", "" + strSmallCTN); PrintLab.PTK_DrawTextTrueTypeW(50, 180, 48, 0, "Arial", 1, 300, false, false, false, "A3", "Destination : " + strDestination); PrintLab.PTK_DrawBarcode(60, 250, 0, "1", 2, 2, 25, 'B', strSmallCTN); PrintLab.PTK_DrawTextTrueTypeW(665, 10, 50, 0, "Arial", 1, 100, false, false, false, "A11", "S.CTN NO : "); PrintLab.PTK_DrawTextTrueTypeW(665, 80, 72, 0, "Arial", 1, 90, false, false, false, "A12", "" + strSmallCTN); PrintLab.PTK_DrawTextTrueTypeW(665, 180, 48, 0, "Arial", 1, 300, false, false, false, "A13", "Destination : " + strDestination); PrintLab.PTK_DrawBarcode(675, 250, 0, "1", 2, 2, 25, 'B', strSmallCTN); // 命令打印机执行打印工作 PrintLab.PTK_PrintLabel(1, 1); //清空缓冲区 PrintLab.PTK_ClearBuffer(); } } PrintLab.ClosePort();//关闭打印机端口 }
/// <summary> /// 定制订单信息打印 /// </summary> public void clothPrint(object printObject) { PrintLab.OpenPort("POSTEK G-3106"); //打开打印机端口 PrintLab.PTK_SetPrintSpeed(4); //设置打印速度 PrintLab.PTK_SetDarkness(10); //设置打印黑度 PrintLab.PTK_SetLabelHeight(172, 15, 0, false); //设置标签的高度和定位间隙\黑线\穿孔的高度 PrintLab.PTK_SetLabelWidth(1252); //设置标签的宽度 PrintLab.PTK_SetDarkness(0); DataTable tbl = (DataTable)printObject; DataView dv = tbl.DefaultView; // 获取总行数 int rowcount = dv.Count; // int index = 1; for (int i = 0; i < rowcount; i++) { //清空缓冲区 PrintLab.PTK_ClearBuffer(); DataRowView dr = dv[i]; string strQcID = dr["QR_ID"].ToString(); // 条形码 string strBarCode = dr["QR_BAR_CODE"].ToString(); string strCutBarCode = ""; if (strBarCode.Length > 7) { strCutBarCode = strBarCode.Substring(strBarCode.Length - 7); } else { strCutBarCode = strBarCode; } // 生产号 string strProCode = dr["PRODUCTION_ORDER"].ToString(); // 订单号 string strOrderCode = dr["ORDER_NO"].ToString(); // 面料号 string strMarterialCode = dr["QR_OTHER4"].ToString(); // 画矩形 //PrintLab.PTK_DrawRectangle(22, 10, 0, 1200, 300); // 打印一行TrueTypeFont文字; PrintLab.PTK_DrawTextTrueTypeW(350, 50, 41, 0, "Arial", 1, 300, false, false, false, "A1", "生产号 :" + strProCode); PrintLab.PTK_DrawTextTrueTypeW(350, 105, 36, 0, "Arial", 1, 100, false, false, false, "A2", "订单号 :" + strOrderCode); PrintLab.PTK_DrawBarcode(360, 160, 0, "1", 2, 2, 30, 'B', strBarCode); //PrintLab.PTK_DrawTextTrueTypeW(350, 205, 36, 0, "Arial", 1, 100, false, false, false, "A3", "面料号:" + strMarterialCode); //PrintLab.PTK_DrawBarcode(360, 250, 0, "1", 3, 3, 35, 'B', strCutBarCode); // 命令打印机执行打印工作 PrintLab.PTK_PrintLabel(1, 1); //updatePrint(strQcID); } PrintLab.ClosePort();//关闭打印机端口 }
private void button1_Click(object sender, EventArgs e) { PrintLab.OpenPort(255); //打开打印机端口 PrintLab.PTK_ClearBuffer(); //清空缓冲区 PrintLab.PTK_SetPrintSpeed(1); //设置打印速度 PrintLab.PTK_SetDarkness(60); //设置打印黑度 PrintLab.PTK_SetLabelHeight(160, 19, 0, false); //设置标签的高度和定位间隙\黑线\穿孔的高度 PrintLab.PTK_SetLabelWidth(520); //设置标签的宽度 for (int i = 1; i <= 1; i++) { // Zgke.MyImage.ImageFile.ImagePcx _Pcx = new Zgke.MyImage.ImageFile.ImagePcx(); // _Pcx.PcxImage = new Bitmap("logo.bmp"); // _Pcx.Save("1.pcx"); // // 画矩形 //// PrintLab.PTK_DrawRectangle(58, 15, 3, 558, 312); // // 打印PCX图片 方式一 // PrintLab.PTK_PcxGraphicsDel("PCX"); // PrintLab.PTK_PcxGraphicsDownload("PCX", "1.pcx"); // PrintLab.PTK_DrawPcxGraphics(10, 5, "PCX"); // PrintLab.PTK_DrawPcxGraphics(260, 5, "PCX"); // 打印PCX图片 方式二 // PTK_PrintPCX(80,30,pchar('logo.pcx')); // 打印一个条码; // PrintLab.PTK_DrawBarcode(300, 23, 0, "1", 2, 2, 50, 'B', "123456789"); // 画表格分割线 //PrintLab.PTK_DrawLineOr(58, 100, 500, 3); //// 打印一行TrueTypeFont文字; PrintLab.PTK_DrawTextTrueTypeW(20, 129, 26, 0, "宋体", 1, 400, false, false, false, "黑体", "1234567890abcdef"); //// 打印一行文本文字(内置字体或软字体); //PrintLab.PTK_DrawText(80, 168, 0, 3, 1, 1, 'N', "Internal Soft Font"); //// 打印PDF417码 //PrintLab.PTK_DrawBar2D_Pdf417(80, 210, 400, 300, 0, 0, 3, 7, 10, 2, 0, 0, "123456789");//PDF417码 //// 打印QR码 PrintLab.PTK_DrawBar2D_QR(70, 4, 300, 300, 0, 5, 2, 0, 0, "http://www.trtos.com/1234567890abcdef"); PrintLab.PTK_DrawBar2D_QR(306, 4, 300, 300, 0, 5, 2, 0, 0, "Postek Electronics Co., Ltd."); // 打印一行TrueTypeFont文字旋转; // PrintLab.PTK_DrawTextTrueTypeW(520, 102, 22, 0, "Arial", 2, 400, false, false, false, "A2", "www.postek.com.cn"); // PrintLab.PTK_DrawTextTrueTypeW(80, 260, 19, 0, "Arial", 1, 700, false, false, false, "A3", "Use different ID_NAME for different Truetype font objects"); // 命令打印机执行打印工作 PrintLab.PTK_PrintLabel(1, 1); } PrintLab.ClosePort();//关闭打印机端口 }
/// <summary> /// 春衫包装打印 /// </summary> public void packageOrderPrintManagerForWechat(object printObject) { PrintLab.OpenPort("POSTEK G-3106"); //打开打印机端口 PrintLab.PTK_SetPrintSpeed(2); //设置打印速度 PrintLab.PTK_SetDarkness(8); //设置打印黑度 PrintLab.PTK_SetLabelHeight(400, 15, 0, false); //设置标签的高度和定位间隙\黑线\穿孔的高度 PrintLab.PTK_SetLabelWidth(1252); //设置标签的宽度 PrintLab.PTK_SetDarkness(0); //清空缓冲区 PrintLab.PTK_ClearBuffer(); DataTable tbl = (DataTable)printObject; string countingNo = ""; string orderNo = ""; string customerName = ""; string materialNo = ""; string strCustomerOrderNo = ""; string strQrBarCode = ""; string strShopName = ""; DataView dv = tbl.DefaultView; if (dv.Count > 0) { DataRowView dr = dv[0]; countingNo = dr["QR_NAME"].ToString(); orderNo = dr["QR_OTHER10"].ToString(); customerName = dr["QR_OTHER12"].ToString(); strCustomerOrderNo = dr["QR_OTHER10"].ToString(); materialNo = dr["QR_OTHER4"].ToString(); strQrBarCode = dr["QR_OTHER14"].ToString(); strShopName = dr["QR_OTHER11"].ToString(); PrintLab.PTK_DrawTextTrueTypeW(320, 50, 40, 0, "Cambria", 5, 100, false, false, false, "A2", "" + countingNo); PrintLab.PTK_DrawTextTrueTypeW(320, 90, 32, 0, "Cambria", 5, 100, false, false, false, "A3", "" + orderNo); PrintLab.PTK_DrawTextTrueTypeW(320, 135, 32, 0, "Cambria", 5, 100, false, false, false, "A4", "" + customerName); PrintLab.PTK_DrawTextTrueTypeW(320, 175, 32, 0, "Cambria", 5, 100, false, false, false, "A5", "" + materialNo); PrintLab.PTK_DrawBarcode(150, 250, 0, "1", 3, 3, 35, 'N', strQrBarCode); PrintLab.PTK_DrawTextTrueTypeW(320, 320, 32, 0, "Cambria", 5, 100, false, false, false, "A6", "" + strShopName); PrintLab.PTK_DrawTextTrueTypeW(940, 50, 40, 0, "Cambria", 5, 100, false, false, false, "A12", "" + countingNo); PrintLab.PTK_DrawTextTrueTypeW(940, 90, 32, 0, "Cambria", 5, 100, false, false, false, "A13", "" + orderNo); PrintLab.PTK_DrawTextTrueTypeW(940, 135, 32, 0, "Cambria", 5, 100, false, false, false, "A14", "" + customerName); PrintLab.PTK_DrawTextTrueTypeW(940, 175, 32, 0, "Cambria", 5, 100, false, false, false, "A15", "" + materialNo); PrintLab.PTK_DrawBarcode(770, 250, 0, "1", 3, 3, 35, 'N', strQrBarCode); PrintLab.PTK_DrawTextTrueTypeW(940, 320, 32, 0, "Cambria", 5, 100, false, false, false, "A16", "" + strShopName); // 命令打印机执行打印工作 PrintLab.PTK_PrintLabel(1, 1); } PrintLab.ClosePort();//关闭打印机端口 }
private void button1_Click(object sender, EventArgs e) { PrintLab.OpenPort(255); //打开打印机端口 PrintLab.PTK_ClearBuffer(); //清空缓冲区 PrintLab.PTK_SetPrintSpeed(4); //设置打印速度 PrintLab.PTK_SetDarkness(10); //设置打印黑度 PrintLab.PTK_SetLabelHeight(600, 16, 0, false); //设置标签的高度和定位间隙\黑线\穿孔的高度 PrintLab.PTK_SetLabelWidth(800); //设置标签的宽度 for (int i = 1; i <= 1; i++) { // 画矩形 PrintLab.PTK_DrawRectangle(58, 15, 3, 558, 312); // 打印PCX图片 方式一 PrintLab.PTK_PcxGraphicsDel("PCX"); PrintLab.PTK_PcxGraphicsDownload("PCX", "logo.pcx"); PrintLab.PTK_DrawPcxGraphics(80, 20, "PCX"); // 打印PCX图片 方式二 // PTK_PrintPCX(80,30,pchar('logo.pcx')); // 打印一个条码; PrintLab.PTK_DrawBarcode(300, 23, 0, "1", 2, 2, 50, 'B', "123456789"); // 画表格分割线 PrintLab.PTK_DrawLineOr(58, 100, 500, 3); // 打印一行TrueTypeFont文字; PrintLab.PTK_DrawTextTrueTypeW(80, 120, 40, 0, "Arial", 1, 400, false, false, false, "A1", "TrueTypeFont"); // 打印一行文本文字(内置字体或软字体); PrintLab.PTK_DrawText(80, 168, 0, 3, 1, 1, 'N', "Internal Soft Font"); // 打印PDF417码 PrintLab.PTK_DrawBar2D_Pdf417(80, 210, 400, 300, 0, 0, 3, 7, 10, 2, 0, 0, "123456789");//PDF417码 // 打印QR码 PrintLab.PTK_DrawBar2D_QR(420, 120, 180, 180, 0, 3, 2, 0, 0, "Postek Electronics Co., Ltd."); // 打印一行TrueTypeFont文字旋转; PrintLab.PTK_DrawTextTrueTypeW(520, 102, 22, 0, "Arial", 2, 400, false, false, false, "A2", "www.postek.com.cn"); PrintLab.PTK_DrawTextTrueTypeW(80, 260, 19, 0, "Arial", 1, 700, false, false, false, "A3", "Use different ID_NAME for different Truetype font objects"); // 命令打印机执行打印工作 PrintLab.PTK_PrintLabel(1, 1); } PrintLab.ClosePort();//关闭打印机端口 }
private void button1_Click(object sender, EventArgs e) { PrintLab.OpenPort("ZMIN X1"); //打开打印机端口,打印机驱动的名称一定要正确 PrintLab.ZM_ClearBuffer(); //清空缓冲区 PrintLab.ZM_SetPrintSpeed(4); //设置打印速度,4是4英寸/秒,6是6英寸/秒(X1最高是6,X1i最高是4) PrintLab.ZM_SetDarkness(10); //设置打印黑度(也是打印温度,最高是20,一般蜡质碳带设置为10,混合基碳带设置为12,树脂基碳带设置为18) PrintLab.ZM_SetLabelHeight(500, 16); //设置标签的高度和标签之间的行间隙,里面的数值是像素值(200dpi是8点/毫米,300dpi是11.8点/毫米,如果计算出小数需取整) //以200dpi打印机X1为例:ZM_SetLabelHeight(500, 16)这样设置是标签高度为500/8=62.5mm,行间隙16/8=2mm PrintLab.ZM_SetLabelWidth(800); //设置标签的宽度 //以200dpi打印机X1为例:ZM_SetLabelWidth(800)这样设置是标签宽度为800/8=100mm for (int i = 1; i <= 1; i++) { // 画矩形 PrintLab.ZM_DrawRectangle(50, 10, 3, 460, 340); // 画表格分割线 PrintLab.ZM_DrawLineOr(60, 108, 402, 3); // 打印PCX图形 PrintLab.ZM_PcxGraphicsDel("PCX"); PrintLab.ZM_PcxGraphicsDownload("PCX", "pic.pcx"); PrintLab.ZM_DrawPcxGraphics(80, 30, "PCX"); // 打印一个128 Auto条码; PrintLab.ZM_DrawBarcode(80, 208, 0, "1", 2, 2, 50, 'B', "123456789"); // 打印PDF417码 PrintLab.ZM_DrawBar2D_Pdf417(80, 300, 400, 300, 0, 0, 3, 7, 10, 2, 0, 0, "123456789");//PDF417码 // 打印QR码 PrintLab.ZM_DrawBar2D_QR(360, 30, 180, 180, 0, 3, 2, 0, 0, "ZMIN Electronics Co., Ltd."); //打印内置字体点阵文字 PrintLab.ZM_DrawText(80, 168, 0, 3, 1, 1, 'N', "Internal Font"); // 打印WINDWOS系统TrueType Font文字; PrintLab.ZM_DrawTextTrueTypeW(80, 120, 40, 0, "Arial", 1, 400, false, false, false, "A1", "TrueType Font"); // 打印WINDWOS系统TrueType Font文字(旋转90度); PrintLab.ZM_DrawTextTrueTypeW(420, 102, 22, 0, "Arial", 2, 400, false, false, false, "A2", "www.zmin.com.cn"); // 开始打印 PrintLab.ZM_PrintLabel(1, 1); //关闭打印机端口 PrintLab.ClosePort(); } }
private void button1_Click(object sender, EventArgs e) { PrintLab.OpenPort("ZMIN X1i"); //打开打印机端口 PrintLab.ZM_ClearBuffer(); //清空缓冲区 PrintLab.ZM_SetPrintSpeed(4); //设置打印速度 PrintLab.ZM_SetDarkness(10); //设置打印黑度 PrintLab.ZM_SetLabelHeight(600, 24); //设置标签的高度和定位间隙\黑线\穿孔的高度 PrintLab.ZM_SetLabelWidth(800); //设置标签的宽度 for (int i = 1; i <= 1; i++) { // 画矩形 PrintLab.ZM_DrawRectangle(50, 10, 3, 460, 340); // 画表格分割线 PrintLab.ZM_DrawLineOr(60, 108, 402, 3); // 打印PCX图形 PrintLab.ZM_PcxGraphicsDel("PCX"); PrintLab.ZM_PcxGraphicsDownload("PCX", "pic.pcx"); PrintLab.ZM_DrawPcxGraphics(80, 30, "PCX"); // 打印一个128 Auto条码; PrintLab.ZM_DrawBarcode(80, 208, 0, "1", 2, 2, 50, 'B', "123456789"); // 打印PDF417码 PrintLab.ZM_DrawBar2D_Pdf417(80, 300, 400, 300, 0, 0, 3, 7, 10, 2, 0, 0, "123456789");//PDF417码 // 打印QR码 PrintLab.ZM_DrawBar2D_QR(360, 30, 180, 180, 0, 3, 2, 0, 0, "ZMIN Electronics Co., Ltd."); //打印内置字体点阵文字 PrintLab.ZM_DrawText(80, 168, 0, 3, 1, 1, 'N', "Internal Font"); // 打印WINDWOS系统TrueType Font文字; PrintLab.ZM_DrawTextTrueTypeW(80, 120, 40, 0, "Arial", 1, 400, false, false, false, "A1", "TrueType Font"); // 打印WINDWOS系统TrueType Font文字(旋转90度); PrintLab.ZM_DrawTextTrueTypeW(420, 102, 22, 0, "Arial", 2, 400, false, false, false, "A2", "www.zmin.com.cn"); // 开始打印 PrintLab.ZM_PrintLabel(1, 1); //关闭打印机端口 PrintLab.ClosePort(); } }
public static void PrintLabel(DataTable dt, int count) { PrintLab.OpenPort("POSTEK TX2r");//打开打印机端口 uint copynumber = Convert.ToUInt16(count); string eqNo = ""; string eqName = ""; string buyDate = ""; string depart = ""; for (int i = 0; i < dt.Rows.Count; i++) { PrintLab.PTK_ClearBuffer(); //清空缓冲区 PrintLab.PTK_SetPrintSpeed(4); //设置打印速度 PrintLab.PTK_SetDarkness(10); //设置打印黑度 PrintLab.PTK_SetLabelHeight(320, 16, 0, false); //设置标签的高度和定位间隙\黑线\穿孔的高度 PrintLab.PTK_SetLabelWidth(560); //设置标签的宽度 eqNo = dt.Rows[i]["资产编码"].ToString(); eqName = dt.Rows[i]["资产名称"].ToString(); buyDate = dt.Rows[i]["取得日期"].ToString(); depart = dt.Rows[i]["使用部门"].ToString(); // 画矩形 PrintLab.PTK_DrawRectangle(8, 8, 10, 552, 312); // 画表格分割线 PrintLab.PTK_DrawLineOr(8, 88, 544, 5); PrintLab.PTK_DrawLineOr(8, 144, 544, 5); PrintLab.PTK_DrawLineOr(8, 200, 368, 5); PrintLab.PTK_DrawLineOr(8, 256, 368, 5); PrintLab.PTK_DrawLineOr(140, 88, 5, 224); PrintLab.PTK_DrawLineOr(376, 144, 5, 168); // 打印标签样式 //PrintLab.PTK_DrawTextTrueTypeW(120, 18, 40, 0, "Arial", 1, 400, false, false, false, "company", "深圳大学师范学院"); PrintLab.PTK_DrawTextTrueTypeW(20, 98, 30, 0, "宋体", 1, 400, false, false, false, "EqName", "资产名称"); PrintLab.PTK_DrawTextTrueTypeW(20, 154, 30, 0, "宋体", 1, 400, false, false, false, "EqNo", "资产编码"); PrintLab.PTK_DrawTextTrueTypeW(20, 210, 30, 0, "宋体", 1, 400, false, false, false, "BuyDate", "购置年月"); PrintLab.PTK_DrawTextTrueTypeW(20, 266, 30, 0, "宋体", 1, 400, false, false, false, "Depart", "使用部门"); PrintLab.PTK_DrawTextTrueTypeW(150, 98, 30, 0, "宋体", 1, 400, false, false, false, "sEqName", eqName); PrintLab.PTK_DrawTextTrueTypeW(150, 154, 30, 0, "宋体", 1, 400, false, false, false, "sEqNo", eqNo); PrintLab.PTK_DrawTextTrueTypeW(150, 210, 30, 0, "宋体", 1, 400, false, false, false, "sBuyDate", buyDate); PrintLab.PTK_DrawTextTrueTypeW(150, 266, 30, 0, "宋体", 1, 400, false, false, false, "sDepart", depart); // 打印QR码 PrintLab.PTK_DrawBar2D_QR(400, 180, 180, 180, 0, 5, 2, 0, 0, eqNo); // 打印PCX图片 方式一 PrintLab.PTK_PcxGraphicsDel("PCX"); PrintLab.PTK_PcxGraphicsDownload("PCX", "logo.pcx"); PrintLab.PTK_DrawPcxGraphics(18, 20, "PCX"); // 命令打印机执行打印工作 PrintLab.PTK_PrintLabel(1, copynumber); } PrintLab.ClosePort();//关闭打印机端口 }
protected void btn_Ok_Click(object sender, EventArgs e) { PrintLab.OpenPort("POSTEK C168/200s"); //打开打印机端口 PrintLab.PTK_ClearBuffer(); //清空缓冲区 PrintLab.PTK_SetPrintSpeed(4); //设置打印速度 PrintLab.PTK_SetDarkness(10); //设置打印黑度 PrintLab.PTK_SetLabelHeight(360, 16); //设置标签的高度和定位间隙\黑线\穿孔的高度 PrintLab.PTK_SetLabelWidth(600); //设置标签的宽度 for (int i = 1; i <= 1; i++) { // 画矩形 PrintLab.PTK_DrawRectangle(42, 30, 5, 558, 260); // 画表格分割线 PrintLab.PTK_DrawLineOr(42, 107, 516, 5); PrintLab.PTK_DrawLineOr(42, 184, 516, 5); //PrintLab.PTK_DrawLineOr(42, 261, 516, 5); // 打印一行TrueTypeFont文字;123456789 string Name = Request.Form["Name"].ToString(); string std = Request.Form["std"].ToString(); string Time = Request.Form["Time"].ToString(); PrintLab.PTK_DrawTextTrueTypeW(70, 50, 40, 0, "Arial", 1, 600, false, false, false, "A1", Name); //PrintLab.PTK_DrawTextTrueTypeW(70, 130, 40, 0, "Arial", 1, 600, false, false, false, "A1", std); // PrintLab.PTK_DrawTextTrueTypeW(70, 200, 40, 0, "Arial", 1, 600, false, false, false, "A1", Time); // 打印一个条码; PrintLab.PTK_DrawBarcode(240, 285, 0, "1", 2, 4, 64, 'N', "ASDQ123456789"); //// 打印PCX图片 方式一 //PrintLab.PTK_PcxGraphicsDel("PCX"); //PrintLab.PTK_PcxGraphicsDownload("PCX", "logo.pcx"); //PrintLab.PTK_DrawPcxGraphics(80, 20, "PCX"); //// 打印PCX图片 方式二 //// PTK_PrintPCX(80,30,pchar('logo.pcx')); //// 打印一行文本文字(内置字体或软字体); //PrintLab.PTK_DrawText(80, 168, 0, 3, 1, 1, 'N', "Internal Soft Font"); //// 打印PDF417码 //PrintLab.PTK_DrawBar2D_Pdf417(80, 210, 400, 300, 0, 0, 3, 7, 10, 2, 0, 0, "123456789");//PDF417码 //// 打印QR码 //PrintLab.PTK_DrawBar2D_QR(420, 120, 180, 180, 0, 3, 2, 0, 0, "Postek Electronics Co., Ltd."); //// 打印一行TrueTypeFont文字旋转; //PrintLab.PTK_DrawTextTrueTypeW(520, 102, 22, 0, "Arial", 2, 400, false, false, false, "A2", "www.postek.com.cn"); //PrintLab.PTK_DrawTextTrueTypeW(80, 260, 19, 0, "Arial", 1, 700, false, false, false, "A3", "Use different ID_NAME for different Truetype font objects"); // 命令打印机执行打印工作 PrintLab.PTK_PrintLabel(1, 2); PrintLab.ClosePort();//关闭打印机端口 } }
/// <summary> /// 正常单裁 订扣 信息打印 /// </summary> public void sbuPrint(object printObject) { PrintLab.OpenPort("POSTEK G-3106"); //打开打印机端口 PrintLab.PTK_SetPrintSpeed(4); //设置打印速度 PrintLab.PTK_SetDarkness(10); //设置打印黑度 PrintLab.PTK_SetLabelHeight(172, 15, 0, false); //设置标签的高度和定位间隙\黑线\穿孔的高度 PrintLab.PTK_SetLabelWidth(1252); //设置标签的宽度 PrintLab.PTK_SetDarkness(0); // 清空缓冲区 PrintLab.PTK_ClearBuffer(); DataTable tbl = (DataTable)printObject; DataView dv = tbl.DefaultView; // 获取总行数 int rowcount = dv.Count; // 条码ID string strQcID = ""; for (int i = 0; i < rowcount; i++) { DataRowView dr = dv[i]; strQcID = dr["QR_ID"].ToString(); // 条形码 string strBarCode = dr["QR_BAR_CODE"].ToString(); // 生产号 string strProNo = dr["PRODUCTION_ORDER"].ToString(); // 大扣数 string strSBU1 = dr["QR_OTHER2"].ToString(); // 小扣数 string strSBU2 = dr["QR_OTHER3"].ToString(); // 扣 string strSBU = dr["QR_OTHER4"].ToString(); // 订扣 string strSAT = dr["QR_OTHER5"].ToString(); // 扣眼颜色 string strSBT = dr["QR_OTHER6"].ToString(); // 打印一行 左侧 PrintLab.PTK_DrawTextTrueTypeW(350, 14, 40, 0, "Arial", 1, 41, false, false, false, "A1", "生产号 :" + strProNo); PrintLab.PTK_DrawTextTrueTypeW(350, 55, 40, 0, "Arial", 1, 41, false, false, false, "A2", "大扣数 :" + strSBU1); PrintLab.PTK_DrawTextTrueTypeW(350, 95, 40, 0, "Arial", 1, 41, false, false, false, "A3", "小扣数 :" + strSBU2); PrintLab.PTK_DrawTextTrueTypeW(350, 135, 40, 0, "Arial", 1, 41, false, false, false, "A4", "扣 :" + strSBU); PrintLab.PTK_DrawTextTrueTypeW(350, 175, 40, 0, "Arial", 1, 41, false, false, false, "A5", "订扣 :" + strSAT); PrintLab.PTK_DrawTextTrueTypeW(350, 225, 40, 0, "Arial", 1, 41, false, false, false, "A6", "订扣线颜色:" + strSBT); PrintLab.PTK_DrawBarcode(380, 280, 0, "1", 2, 2, 30, 'B', strBarCode); // 命令打印机执行打印工作 PrintLab.PTK_PrintLabel(1, 1); // 清空缓冲区 PrintLab.PTK_ClearBuffer(); //updatePrint(strQcID); } // 命令打印机执行打印工作 PrintLab.PTK_PrintLabel(1, 1); //updatePrint(strQcID); PrintLab.ClosePort();//关闭打印机端口 }
/// <summary> /// 裁剪信息打印 /// </summary> public void clipOrderPrint(object printObject) { PrintLab.OpenPort("POSTEK G-3106"); //打开打印机端口 PrintLab.PTK_SetPrintSpeed(5); //设置打印速度 PrintLab.PTK_SetDarkness(10); //设置打印黑度 //PrintLab.PTK_SetLabelHeight(345, 15, 0, false); //设置标签的高度和定位间隙\黑线\穿孔的高度 PrintLab.PTK_SetLabelHeight(260, 15, 0, false); //设置标签的高度和定位间隙\黑线\穿孔的高度 PrintLab.PTK_SetLabelWidth(1252); //设置标签的宽度 PrintLab.PTK_SetDarkness(0); DataTable tbl = (DataTable)printObject; String strQrId = ""; String strOrderNo = ""; String strProductOrder = ""; String strCustomerOrderNo = ""; String strBarCode = ""; String strClipNumber = ""; DataView dv = tbl.DefaultView; if (dv.Count > 0) { DataRowView dr = dv[0]; strQrId = dr["QR_ID"].ToString(); strOrderNo = dr["QR_OTHER0"].ToString(); strProductOrder = dr["QR_OTHER9"].ToString(); strCustomerOrderNo = dr["QR_NAME"].ToString(); strBarCode = dr["QR_BAR_CODE"].ToString(); strClipNumber = dr["QR_CLIP_NUMBER"].ToString(); int iPageNumber = int.Parse(strClipNumber) / 2; int iRemain = int.Parse(strClipNumber) % 2; for (int i = 0; i < iPageNumber; i++) { //清空缓冲区 PrintLab.PTK_ClearBuffer(); PrintLab.PTK_DrawTextTrueTypeW(210, 40, 35, 0, "Arial", 1, 300, false, false, false, "A1", "生产号: " + strProductOrder); PrintLab.PTK_DrawBarcode(225, 100, 0, "1", 2, 2, 30, 'B', strBarCode); PrintLab.PTK_DrawTextTrueTypeW(650, 40, 35, 0, "Arial", 1, 300, false, false, false, "A2", "生产号: " + strProductOrder); PrintLab.PTK_DrawBarcode(665, 100, 0, "1", 2, 2, 30, 'B', strBarCode); // 命令打印机执行打印工作 PrintLab.PTK_PrintLabel(1, 1); } if (iRemain > 0) { //清空缓冲区 PrintLab.PTK_ClearBuffer(); PrintLab.PTK_DrawTextTrueTypeW(210, 40, 35, 0, "Arial", 1, 300, false, false, false, "A3", "生产号: " + strProductOrder); PrintLab.PTK_DrawBarcode(225, 100, 0, "1", 2, 2, 30, 'B', strBarCode); // 命令打印机执行打印工作 PrintLab.PTK_PrintLabel(1, 1); } } PrintLab.ClosePort();//关闭打印机端口 }
/// <summary> /// 服装包装信息打印 /// </summary> public void packageOrderPrintManager(object printObject) { PrintLab.OpenPort("POSTEK G-3106"); //打开打印机端口 PrintLab.PTK_SetPrintSpeed(2); //设置打印速度 PrintLab.PTK_SetDarkness(8); //设置打印黑度 PrintLab.PTK_SetLabelHeight(400, 15, 0, false); //设置标签的高度和定位间隙\黑线\穿孔的高度 PrintLab.PTK_SetLabelWidth(1252); //设置标签的宽度 PrintLab.PTK_SetDarkness(0); //清空缓冲区 PrintLab.PTK_ClearBuffer(); DataTable tbl = (DataTable)printObject; string strShopName = ""; string strCustomerName = ""; string strProductOrder = ""; string strCustomerOrderNo = ""; string strQrBarCode = ""; string strMakeType = ""; string strSmallBox = ""; string strTailor = ""; string strDestinationCode = ""; string strHangerSize = ""; string strShirtItem = ""; string strHangtag = ""; string strShopNumber = ""; int iPx1 = 0; int iPx2 = 0; DataView dv = tbl.DefaultView; if (dv.Count > 0) { DataRowView dr = dv[0]; strShopName = dr["QR_OTHER11"].ToString(); strCustomerName = dr["QR_OTHER12"].ToString(); strProductOrder = dr["QR_OTHER9"].ToString(); strCustomerOrderNo = dr["QR_OTHER10"].ToString(); strQrBarCode = "*" + dr["QR_BAR_CODE"].ToString() + "*"; strMakeType = dr["QR_OTHER13"].ToString(); strSmallBox = dr["QR_OTHER15"].ToString(); strTailor = dr["QR_OTHER21"].ToString(); strDestinationCode = dr["QR_OTHER22"].ToString(); strHangerSize = dr["QR_OTHER23"].ToString(); strShirtItem = dr["QR_OTHER24"].ToString(); strHangtag = dr["QR_OTHER19"].ToString(); strShopNumber = dr["QR_OTHER25"].ToString(); if (!"".Equals(strHangerSize)) { strHangerSize = "{" + strHangerSize + "}"; } if (strQrBarCode.Length == 8) { iPx1 = 145; iPx2 = 670 + 100; } else if (strQrBarCode.Length == 12) { iPx1 = 90; iPx2 = 670 + 40; } else if (strQrBarCode.Length == 13) { iPx1 = 70; iPx2 = 670 + 20; } else if (strQrBarCode.Length == 14) { iPx1 = 130; iPx2 = 670 + 80; } else { iPx1 = 90; iPx2 = 670 + 40; } if (strQrBarCode.Length < 14) { PrintLab.PTK_DrawTextTrueTypeW(320, 50, 40, 0, "Cambria", 5, 100, false, false, false, "A2", "" + strCustomerOrderNo); PrintLab.PTK_DrawTextTrueTypeW(320, 90, 32, 0, "Cambria", 5, 100, false, false, false, "A3", "" + strShopName + "," + strTailor); PrintLab.PTK_DrawTextTrueTypeW(320, 125, 32, 0, "Cambria", 5, 100, false, false, false, "A4", "" + strCustomerName); PrintLab.PTK_DrawTextTrueTypeW(320, 170, 36, 0, "Cambria", 5, 100, false, false, false, "A7", "" + strShopNumber); PrintLab.PTK_DrawBarcode((uint)iPx1, 200, 0, "1", 3, 3, 35, 'N', strQrBarCode); PrintLab.PTK_DrawTextTrueTypeW(320, 270, 36, 0, "Cambria", 5, 100, false, false, false, "A5", "" + strDestinationCode + strHangerSize + "|[" + strMakeType + "]" + strShirtItem); PrintLab.PTK_DrawTextTrueTypeW(320, 305, 36, 0, "Cambria", 5, 100, false, false, false, "A6", "" + strHangtag); PrintLab.PTK_DrawTextTrueTypeW(320, 335, 38, 0, "Cambria", 5, 100, false, false, false, "A1", "" + strSmallBox); PrintLab.PTK_DrawTextTrueTypeW(940, 50, 40, 0, "Cambria", 5, 100, false, false, false, "A12", "" + strCustomerOrderNo); PrintLab.PTK_DrawTextTrueTypeW(940, 90, 32, 0, "Cambria", 5, 100, false, false, false, "A13", "" + strShopName + "," + strTailor); PrintLab.PTK_DrawTextTrueTypeW(940, 125, 32, 0, "Cambria", 5, 100, false, false, false, "A14", "" + strCustomerName); PrintLab.PTK_DrawTextTrueTypeW(940, 170, 36, 0, "Cambria", 5, 100, false, false, false, "A17", "" + strShopNumber); PrintLab.PTK_DrawBarcode((uint)iPx2, 200, 0, "1", 3, 3, 35, 'N', strQrBarCode); PrintLab.PTK_DrawTextTrueTypeW(940, 270, 36, 0, "Cambria", 5, 100, false, false, false, "A15", "" + strDestinationCode + strHangerSize + "|[" + strMakeType + "]" + strShirtItem); PrintLab.PTK_DrawTextTrueTypeW(940, 305, 36, 0, "Cambria", 5, 100, false, false, false, "A16", "" + strHangtag); PrintLab.PTK_DrawTextTrueTypeW(940, 335, 38, 0, "Cambria", 5, 100, false, false, false, "A11", "" + strSmallBox); } else { PrintLab.PTK_DrawTextTrueTypeW(320, 50, 40, 0, "Cambria", 5, 100, false, false, false, "A2", "" + strCustomerOrderNo); PrintLab.PTK_DrawTextTrueTypeW(320, 90, 32, 0, "Cambria", 5, 100, false, false, false, "A3", "" + strShopName + "," + strTailor); PrintLab.PTK_DrawTextTrueTypeW(320, 125, 32, 0, "Cambria", 5, 100, false, false, false, "A4", "" + strCustomerName); PrintLab.PTK_DrawTextTrueTypeW(320, 170, 36, 0, "Cambria", 5, 100, false, false, false, "A7", "" + strShopNumber); PrintLab.PTK_DrawBarcode((uint)iPx1, 200, 0, "1", 2, 3, 35, 'N', strQrBarCode); PrintLab.PTK_DrawTextTrueTypeW(320, 270, 36, 0, "Cambria", 5, 100, false, false, false, "A5", "" + strDestinationCode + strHangerSize + "|[" + strMakeType + "]" + strShirtItem); PrintLab.PTK_DrawTextTrueTypeW(320, 305, 36, 0, "Cambria", 5, 100, false, false, false, "A6", "" + strHangtag); PrintLab.PTK_DrawTextTrueTypeW(320, 335, 38, 0, "Cambria", 5, 100, false, false, false, "A1", "" + strSmallBox); PrintLab.PTK_DrawTextTrueTypeW(940, 50, 40, 0, "Cambria", 5, 100, false, false, false, "A12", "" + strCustomerOrderNo); PrintLab.PTK_DrawTextTrueTypeW(940, 90, 32, 0, "Cambria", 5, 100, false, false, false, "A13", "" + strShopName + "," + strTailor); PrintLab.PTK_DrawTextTrueTypeW(940, 125, 32, 0, "Cambria", 5, 100, false, false, false, "A14", "" + strCustomerName); PrintLab.PTK_DrawTextTrueTypeW(940, 170, 36, 0, "Cambria", 5, 100, false, false, false, "A17", "" + strShopNumber); PrintLab.PTK_DrawBarcode((uint)iPx2, 200, 0, "1", 2, 3, 35, 'N', strQrBarCode); PrintLab.PTK_DrawTextTrueTypeW(940, 270, 36, 0, "Cambria", 5, 100, false, false, false, "A15", "" + strDestinationCode + strHangerSize + "|[" + strMakeType + "]" + strShirtItem); PrintLab.PTK_DrawTextTrueTypeW(940, 305, 36, 0, "Cambria", 5, 100, false, false, false, "A16", "" + strHangtag); PrintLab.PTK_DrawTextTrueTypeW(940, 335, 38, 0, "Cambria", 5, 100, false, false, false, "A11", "" + strSmallBox); } // 命令打印机执行打印工作 PrintLab.PTK_PrintLabel(1, 1); } PrintLab.ClosePort();//关闭打印机端口 }