Files
point_of_sale/PointOfSale/Pos.Ui/EpsonPrinter/Services/PrintFooter.cs
Bjarne Pedersen 41e23b6184 Initial commit
Initial commit til Git.
V2 er deployed
2026-06-13 17:31:50 +02:00

48 lines
1.3 KiB
C#

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<byte[][]> Print(List<FooterModel> model)
{
List<byte[][]> data = new List<byte[][]>();
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;
}
}
}