48 lines
1.3 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|