Closed detectivejd closed 11 months ago
Please!, I need to help with this code, this proyect was migrated from .net framework 4.6.2 to .net 7 and it has a great value to the principal proyect that execute it.
You response me, please!.
So, is it printing the full receipt? What do you do to get it printing once again? Do you have to restart the application, do you have to unplug and replug the printer?
Have you tried to use the same printer instance for all your printing? Sounds like you are not destroying your FilePrinter instance after you have used it, and probably that's what is holding the connection. I would suggest looking at the ConsoleTests class to see how you could do it properly. But either you keep using the same instance of FilePrinter for all your prints, or you have to dispose of it, before trying to create a new instance. You could do that with using
as showed below:
using (FilePrinter printer = new FilePrinter(filePath: Destino))
Thank you for your answer, the issue was resolved, I needed that impress was a atribute class:
public FilePrinter Impresora { get; set; }
after of the new instance, I use my impress method of this way:
public void RealizarImpresionTicketIngreso(Entrada tick) { try { var e = new EPSON(); Impresora.Write(ObtenerTicketDeIngreso(tick, e)); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
And it worked it:
Thanks for all. Greetings.
Sure thing, you created a property and persisted the instance of FilePrinter. Just a heads-up, that will not solve 100% of your problems, if you ever try to have a second instance of that class of yours, with a new FilePrinter property, you will get the same behavior as before.
Sorry for digging this up but what is the difference between 1.6 and 3.0?
After it prints the first time, I'm facing an error
System.IO.IOException: Device or resource busy : '/dev/usb/lp3'
I tried both options
var printerLinUsb = new FilePrinter(filePath: '/dev/usb/lp3'`, false);
...
printerLinUsb.Dispose();
and
using (var printerLinUsb = new FilePrinter(filePath: '/dev/usb/lp3'`, false))
{
...
}
Hi, how are you? I wait that you are good. I have the next trouble in Linux using this library:
I need to doing lots of impressions and only it impress the first ticket of the impress queue.
This is my code:
I need to help with urgency, if you can answer me, I will appreciate it.
Greetings.