Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
558 views
in Technique[技术] by (71.8m points)

pos for .net - pos explorer is not finding any device connected to the system in C#

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)");
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...