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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…