Epson TM-m30III не печатает символ £C#

Место общения программистов C#
Ответить
Anonymous
 Epson TM-m30III не печатает символ £

Сообщение Anonymous »

Epson TM-m30III настроен в служебном приложении следующим образом:
Изображение

Я пытаюсь распечатать на принтере в классе C# с помощью Windows.Devices.PointOfService библиотека. Мой код:

Код: Выделить всё

public async Task PrintReceipt(string textToPrint)
{
try
{
PosPrinter posPrinter = await PosPrinter.GetDefaultAsync();

if (posPrinter == null)
{
// Handle case where no printer is found.
return;
}

_claimedPrinter = await posPrinter.ClaimPrinterAsync();

// Set the character set ID on the claimed printer object.
// 858 is a common European code page that includes '£'.
_claimedPrinter.CharacterSet = 858;

await _claimedPrinter.EnableAsync();

ReceiptPrintJob job = _claimedPrinter.Receipt.CreateJob();

//// Get the correct encoding for the WPC1252 code page
//Encoding wpc1252 = Encoding.GetEncoding(1252);

//// Convert the string to a byte array using the WPC1252 encoding
//byte[] encodedBytes = wpc1252.GetBytes(textToPrint);

//// Now, convert the byte array back to a string
//// This is the string you should send to the printer
//string encodedString = wpc1252.GetString(encodedBytes);

job.Print(textToPrint);

bool result = await job.ExecuteAsync();

if (result)
{
// Printing was successful.
}
else
{
logger.LogWarning("Printing failed. Checking printer status.");

if (_claimedPrinter.IsCoverOpen)
{
logger.LogWarning("Printer cover is open.");
}
if (_claimedPrinter.Receipt.IsPaperEmpty)
{
logger.LogWarning("Receipt printer is out of paper.");
}
}
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
finally
{
_claimedPrinter.Dispose();
}
}
Я пытался явно установить набор символов, а также пытался закодировать строку, однако любые символы £ в параметре textToPrint не печатаются, а вместо этого печатается этот символ.
Изображение


Подробнее здесь: https://stackoverflow.com/questions/797 ... %a3-symbol
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C#»