zoukankan      html  css  js  c++  java
  • POS 打印机编程控制

    硬件: EPSON TMH6000M

    软件: EPSON OPOS ADK 2.5

            Microsoft POS for .net 1.12

    step 1.

     EPSON OPOS ADK 2.5 是pos打印机的驱动的集合. 安装后接上pos打印机,

    开始菜单里面有一个setup pos的工具, 添加pos打印机,选择合适的端口, 安装完成要给该pos打印机起一个LogicalName,供程序使用

    step 2

     安装Microsoft POS for .net 1.12, 这个是微软对POS设备的封装层.只要是符合国际标准的设备都能识别使用.

    step 3

         .net代码 引用 Microsoft.PointOfService

      示例代码:

     如果要打印中文(簡體/繁體), 則要留意Printer的CharacterSetList有沒有包含936,950,

    另外要注意window區域設置的non-unicode的設定是否一致.例如你要打繁體的話,就必須設置成中國香港(950)

                

    代码
     1 //Use a Logical Device Name which has been set on the SetupPOS.
     2             string strLogicalName = "PosPrinter";
     3 
     4             //Create PosExplorer
     5             PosExplorer posExplorer = new PosExplorer();
     6 
     7             DeviceInfo deviceInfo = null;
     8 
     9             try
    10             {
    11                 deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, strLogicalName);
    12 
    13       m_Printer = (PosPrinter)posExplorer.CreateInstance(deviceInfo);
    14                 //Open the device
    15                 m_Printer.Open();
    16 
    17                 //Get the exclusive control right for the opened device.
    18                 //Then the device is disable from other application.
    19                 m_Printer.Claim(1000);
    20 
    21                //Enable the device.
    22                 m_Printer.DeviceEnabled = true;
    23 
    24       m_Printer.PrintNormal(PrinterStation.Receipt, "Hello World!\n"); 
    25 
    26            }
    27             catch (Exception)
    28             {
    29 
    30             }
    31 
    32 

       

  • 相关阅读:
    将十进制的颜色制转换成ARGB
    HTTPS从认识到线上实战全记录
    如何从零开始对接第三方登录(Java版):QQ登录和微博登录
    JS弹出下载对话框以及实现常见文件类型的下载
    【干货】Chrome插件(扩展)开发全攻略
    Lucene5.5.4入门以及基于Lucene实现博客搜索功能
    ReactNative与NativeScript对比报告
    JavaScript常见原生DOM操作API总结
    JS获取剪贴板图片之后的格式选择与压缩问题
    详细记录一下网站备案经过,备案真的很简单
  • 原文地址:https://www.cnblogs.com/zitjubiz/p/1695462.html
Copyright © 2011-2022 走看看