pos explorer is not finding any device connected to the system in C#

泄露秘密 提交于 2019-12-11 03:54:16

问题


Hi I have installed Star TSP100 Cutter (TSP143) printer driver in my system and tested the printer, Its printing everything. But Now i want to handle the printer through code in c# such as cut paper, Open Printer, Print normal etc.. I have used the below code to instantiate the printer. When i query for the printer it returns null.

Any suggestions or help if i am going in wrong way. Thanks

public static DeviceCollection GetPrinters()
    {
        PosExplorer explorer = new PosExplorer();
        return explorer.GetDevices(DeviceType.PosPrinter, DeviceCompatibilities.OposAndCompatibilityLevel1);
    }

    public static DeviceInfo GetPrinter(string name)
    {
        if (String.IsNullOrEmpty(name))
            return null;

        PosExplorer explorer = new PosExplorer();
        return explorer.GetDevice(DeviceType.PosPrinter, name);
    }
PosExplorer explorer = null;
                DeviceInfo device = null;
                PosPrinter printer = null;
                DeviceCollection printers = GetPrinters();

                DeviceInfo printers2 = GetPrinter("Star TSP100 Cutter (TSP143)");

回答1:


It sounds like the incorrect command is being sent. The TSP100 differs from the rest of the printers in Star's line up. It needs to receive raster commands. The other printers generally accept line mode by default.

Reference their programming manual here: http://www.starmicronics.com/support/Mannualfolder/linemode_cm_en.pdf

Page 87: Shows you how to initialize raster mode

Page 90: Cash Drawer

Page 92: Feed/Cut



来源:https://stackoverflow.com/questions/11411745/pos-explorer-is-not-finding-any-device-connected-to-the-system-in-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!