using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using EpsonPrinter.Model; using ESCPOS_NET; using ESCPOS_NET.Emitters; namespace EpsonPrinter.Services { public class PrintFooter { private ICommandEmitter _e; public PrintFooter(ICommandEmitter e) { _e = e; } public List Print(List model) { List data = new List(); PrintStyleCombination printStyleCombination = new PrintStyleCombination(); PrintAlignment printAlignment = new PrintAlignment(); byte[][] feedLines = { _e.FeedLines(1) }; data.Add(feedLines); foreach (FooterModel footerModel in model) { PrintStyle printStyle = printStyleCombination.Combine(footerModel.PrintStyles); byte[][] bytes = { _e.SetStyles(PrintStyle.None), printAlignment.GetTextAlignment(_e,footerModel.TextAlignment), _e.SetStyles(printStyle), _e.PrintLine(footerModel.Value), _e.FeedLines(footerModel.FeedingLines) }; data.Add(bytes); } return data; } } }