こんにちは、スター TSP100 カッター (TSP143) プリンター ドライバーをシステムにインストールし、プリンターをテストしました。しかし、今では、カット紙、プリンターを開く、通常の印刷などのC#のコードを使用してプリンターを処理したいと考えています。以下のコードを使用してプリンターをインスタンス化しました。プリンターを照会すると、null が返されます。
私が間違った方向に進んでいる場合は、何か提案や助けが必要です。ありがとう
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)");