园里的条码打印,都是Zebra机的。立象机的,还没有,我算是首发吧,呵呵。
简单说明一下,市场上条码打印机,大致分单标签和双标签打印机,至少我见到的是这样,还有没三个、四个的就不清楚了。
Code using System;using System.Runtime.InteropServices;using System.Collections.Generic;using System.Text;namespace Kurodo.Printer{ public class Printer { [DllImport("WINPPLb.DLL", EntryPoint = "B_Set_Darkness")] public static extern void B_Set_Darkness(int darkness); [DllImport("WINPPLb.DLL", EntryPoint = "B_CreatePrn")] public static extern void B_CreatePrn(int selection, string FileName); [DllImport("WINPPLb.DLL", EntryPoint = "B_Print_Out")] public static extern void B_Print_Out(int copypiece); [DllImport("WINPPLb.DLL", EntryPoint = "B_Prn_Text")] public static extern void B_Prn_Text(int x, int y, int ori, int font, int hor_factor, int ver_factor, char mode, string data); [DllImport("WINPPLb.DLL", EntryPoint = "B_Prn_Barcode")] public static extern void B_Prn_Barcode(int x, int y, int ori, string typee, int narrow, int width, int height, char human, string data); [DllImport("WINPPLb.DLL", EntryPoint = "B_Prn_Text_TrueType")] public static extern void B_Prn_Text_TrueType(int x, int y, int FSize, string FType, int Fspin, int FWeight, int FItalic, int FUnline, int FStrikeOut, string id_name, string data); [DllImport("WINPPLb.DLL", EntryPoint = "B_Get_Pcx")] public static extern void B_Get_Pcx(int x, int y, string filename); [DllImport("WINPPLb.dll", EntryPoint = "B_ClosePrn")] public static extern void B_ClosePrn(); public Printer() { } public static void SingleList(string name, string code, string size, string price) { B_CreatePrn(1, "PPLB_A.txt"); B_Set_Darkness(14); B_Prn_Text_TrueType(140, 35, 40, "宋体", 1, 100, 0, 0, 0, "namel", name); B_Prn_Barcode(70, 80, 0, "1", 2, 2, 40, 'b', code); B_Prn_Text_TrueType(50, 150, 40, "宋体", 1, 70, 0, 0, 0, "sizel", "尺码:" + size); B_Prn_Text_TrueType(230, 150, 40, "宋体", 1, 70, 0, 0, 0, "pricel", "售价:" + price); B_Print_Out(1); B_ClosePrn(); } public static void LeftPoint(string name, string code, string size, string price) { B_CreatePrn(1, "PPLB_B.txt"); B_Set_Darkness(14); B_Prn_Text_TrueType(140, 35, 40, "宋体", 1, 100, 0, 0, 0, "namel", name); B_Prn_Barcode(70, 80, 0, "1", 2, 2, 40, 'b', code); B_Prn_Text_TrueType(50, 150, 40, "宋体", 1, 70, 0, 0, 0, "sizel", "尺码:" + size); B_Prn_Text_TrueType(230, 150, 40, "宋体", 1, 70, 0, 0, 0, "pricel", "售价:" + price); } public static void RightPoint(string name, string code, string size, string price) { B_Prn_Text_TrueType(540, 35, 40, "宋体", 1, 100, 0, 0, 0, "namer", name); B_Prn_Barcode(470, 80, 0, "1", 2, 2, 40, 'b', code); B_Prn_Text_TrueType(450, 150, 40, "宋体", 1, 70, 0, 0, 0, "sizer", "尺码:" + size); B_Prn_Text_TrueType(630, 150, 40, "宋体", 1, 70, 0, 0, 0, "pricer", "售价:" + price); } public static void ClosePoint() { B_Print_Out(1); B_ClosePrn(); } public static void DuallList(PrintList[] Pl) { for (int i = 0; i < Pl.Length; i++) { for (int j = 1; j <= Pl[i].Total; j += 2) { Printer.LeftPoint("左边标签", Pl[i].BarCode, Pl[i].Size, Pl[i].Price); if (j + 1 < Pl[i].Total) { Printer.RightPoint("右边标签", Pl[i].BarCode, Pl[i].Size, Pl[i].Price); } Printer.ClosePoint(); } } } }}转载于:https://www.cnblogs.com/Kurodo/archive/2009/04/01/1426836.html
相关资源:立象os-214plus二次开发库及中文文档