问题
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