Привет, я пытаюсь просто напечатать «Hello World», но получаю сообщение об ошибке: «Значение свойства DevicePath должно быть определено объектом службы, прежде чем можно будет вызвать Open()». и он указывает на эту строку print.Open();
Я использую .NET 4.8 и ссылаюсь на Microsoft.PointOfService; уже. ТИА.
using Microsoft.PointOfService;
using System;
namespace PrinterTest
{
class Program
{
static void Main(string[] args)
{
PosExplorer explorer = new PosExplorer();
DeviceCollection devices = explorer.GetDevices(DeviceType.PosPrinter);
Console.WriteLine("Checking for connected POS Printers...");
foreach (DeviceInfo device in devices)
{
if (device.ServiceObjectName.IndexOf("TM-U220B", StringComparison.OrdinalIgnoreCase) >= 0)
{
Console.WriteLine("TM-U220B printer is connected!");
PosPrinter printer = (PosPrinter)explorer.CreateInstance(device);
printer.Open();
printer.Claim(1000);
printer.DeviceEnabled = true;
printer.PrintNormal(PrinterStation.Receipt, "Hello World\n");
//printer.Cut(PosPrinterCutType.FullCut);
printer.Release();
printer.Close();
Console.WriteLine("Printed 'Hello World' successfully.");
break;
}
}
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... on-printer
Не могу напечатать «Hello World» на принтере EPSON ⇐ C#
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Android — Epson ePos SDK — Невозможно выполнить печать на принтере Epson TM-T88VI
Anonymous » » в форуме Android - 0 Ответы
- 60 Просмотры
-
Последнее сообщение Anonymous
-