You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to print, so I don't want to use the ByteSplicer.Combine method because I have a dynamic foreach in the product list. Is there any way to print without using ByteSplicer.Combine?
My code below:
public async Task Print(int IDVenda)
{
var hostnameOrIp = "180.22.2.37";
var port = 9100;
var printer = new ImmediateNetworkPrinter(new ImmediateNetworkPrinterSettings() { ConnectionString = $"{hostnameOrIp}:{port}", PrinterName = "TestPrinter" });
var response = false;
var e = new EPSON();
try
{
Venda venda = await dbfitaz.Vendas.FindAsync(IDVenda);
if (venda == null)
{
return Json(new { success = false, message = "Sales Not Found" }, JsonRequestBehavior.AllowGet);
}
Hey @Eduardomendesc, of course you can! ByteSplicer is just a helper method, you don't need it to print anything!
the Printer.Write() method (or in your case Printer.WriteAsync()) intakes a byte[] parameter, or even any amount of byte[] parameters you wish to send to it!
So, you can just have a byte[] variable that stores what you wish to print. You go through your ForEach, appending every byte into the variable, and lastly you call the Write method passing the variable as a parameter.
However if you really want to go the LINQ route, perhaps you would like to use Select() instead of ForEach(), something like this
I want to print, so I don't want to use the ByteSplicer.Combine method because I have a dynamic foreach in the product list. Is there any way to print without using ByteSplicer.Combine?
My code below:
public async Task Print(int IDVenda)
{
var hostnameOrIp = "180.22.2.37";
var port = 9100;
var printer = new ImmediateNetworkPrinter(new ImmediateNetworkPrinterSettings() { ConnectionString = $"{hostnameOrIp}:{port}", PrinterName = "TestPrinter" });
var response = false;
var e = new EPSON();
try
{
Venda venda = await dbfitaz.Vendas.FindAsync(IDVenda);
if (venda == null)
{
return Json(new { success = false, message = "Sales Not Found" }, JsonRequestBehavior.AllowGet);
}
}
The text was updated successfully, but these errors were encountered: