mtmsuhail / ESC-POS-USB-NET

This project is a simple .NET (C#) Implementation of the Epson ESC/POS Printing using USB Device Driver.
MIT License
202 stars 86 forks source link

System.ArgumentException when trying to send a print command #52

Open arno-developer opened 2 years ago

arno-developer commented 2 years ago

Good day,

I get the following error when I try to trigger the TestPrinter function.

I am using a EPSON TM-T70II thermal printer and my code is as follow (C# dotnet core 6, Console app ):

try
{
    printer = new Printer("EPSON TM-T70II Receipt");
    printer.TestPrinter();
}
catch (Exception ex)
{
    Console.WriteLine($"Printer Error: {ex}");
    throw new Exception(ex.Message, ex);
}
KaiPser commented 2 years ago

Hi,

maybe you found the solution in the meantime. Had the same issue right now. Solution was found on gitlab as well, to make it short:

-- System.Text.EncodingProvider ppp = System.Text.CodePagesEncodingProvider.Instance; Encoding.RegisterProvider(ppp);

Worked for some users including me.