现在我正在做一个C#Winform的项目,其中想打印小票就和超市的那种效果差不多的,用的打印机是POS58,指令支持ESC/POS;接口是USB接口,我该怎么和打印机通信并控制打印机打印呢,希望高手给个完整的例子或者类似的也行,很急.....跪求

解决方案 »

  1.   

    c#驱动任意COM接口的小票机(POS热敏打印机) 
    代码目的:c#驱动小票机,能够开钱箱、打印销售凭条等。代码测试片段: 代码 
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.IO;
    using System.Threading;namespace Pixysoft.ITer.Printer.Zonerich
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("测试打开钱箱");            Test01();            Console.WriteLine("测试打印小票");            Test02();            Console.Read();
            }        public static void Test01()
            {
                //打开钱箱操作            string printername = "中崎 AB-58MK";//这个要看打印机配置成什么名字,例如我是中崎 AB-58MK            RawPrinterHelper.SendStringToPrinter(printername,
        ((char)27).ToString() + "p" +
        ((char)0).ToString() + ((char)60).ToString() + ((char)255).ToString());
            }        public static void Test02()
            {
                //打印票据            //因为直接发送数据给小票机会出现丢失数据问题,所以我一般先把文件保存在本地,然后打印            string printername = "中崎 AB-58MK";//这个要看打印机配置成什么名字,例如我是中崎 AB-58MK            string filename = @"e:\demo.txt";            string content = "hello world";            File.WriteAllText(filename, content, Encoding.GetEncoding("gb2312"));            RawPrinterHelper.SendFileToPrinter(printername, filename);
            }
        }
    }
      

  2.   

    RawPrinterHelper 类能一起给我?谢谢