Initial commit
Initial commit til Git. V2 er deployed
This commit is contained in:
47
PointOfSale/EpsonPrinterLinux/Services/PrintHeader.cs
Normal file
47
PointOfSale/EpsonPrinterLinux/Services/PrintHeader.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using EpsonPrinter.Model;
|
||||
using ESCPOS_NET;
|
||||
using ESCPOS_NET.Emitters;
|
||||
using ESCPOS_NET.Utilities;
|
||||
|
||||
namespace EpsonPrinter.Services
|
||||
{
|
||||
public class PrintHeader
|
||||
{
|
||||
private ICommandEmitter _e;
|
||||
|
||||
public PrintHeader(ICommandEmitter e)
|
||||
{
|
||||
_e = e;
|
||||
}
|
||||
|
||||
public List<Byte[][]> Print(List<HeaderModel> model)
|
||||
{
|
||||
List<byte[][]> data = new List<byte[][]>();
|
||||
PrintStyleCombination printStyleCombination = new PrintStyleCombination();
|
||||
PrintAlignment printAlignment = new PrintAlignment();
|
||||
foreach (HeaderModel headerModel in model)
|
||||
{
|
||||
|
||||
PrintStyle printStyle = printStyleCombination.Combine(headerModel.PrintStyles);
|
||||
byte[][] bytes = {
|
||||
_e.SetStyles(PrintStyle.None),
|
||||
printAlignment.GetTextAlignment(_e,headerModel.TextAlignment),
|
||||
_e.SetStyles(printStyle),
|
||||
_e.PrintLine(headerModel.Value),
|
||||
_e.FeedLines(headerModel.FeedingLines)
|
||||
};
|
||||
data.Add(bytes);
|
||||
}
|
||||
byte[][] feedLines =
|
||||
{
|
||||
_e.FeedLines(1)
|
||||
};
|
||||
data.Add(feedLines);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user