-
-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to use foreach inside ByteSplicer.Combine or other way to print ? #274
Comments
Hey @Eduardomendesc, of course you can! ByteSplicer is just a helper method, you don't need it to print anything! So, you can just have a However if you really want to go the LINQ route, perhaps you would like to use Select() instead of ForEach(), something like this /* .
.
.
*/
e.SetStyles(PrintStyle.FontB),
ByteSplicer.Combine(venda.VendaProdutos.Select(vendasPrd =>
{
ByteSplicer.Combine(
e.PrintLine(vendasPrd.Produto.Product_name),
e.PrintLine(vendasPrd.Qtd + " * " + vendasPrd.Preco_unitario + " " + vendasPrd.Total),
e.PrintLine("------------------------------------------------")
);
})),
e.RightAlign(),
/* .
.
.
*/ WARNING: I haven't tested this code, just trying to show you the concept idea. |
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: