printer-api/PrinterService.cs
2022-02-17 16:45:42 +01:00

37 lines
683 B
C#

using ESCPOS_NET;
using ESCPOS_NET.Emitters;
using ESCPOS_NET.Extensions;
using ESCPOS_NET.Utilities;
public class PrinterService
{
private BasePrinter printer;
private EPSON e = new EPSON();
public PrinterService(string filePath)
{
printer = new FilePrinter(filePath);
}
public string GetName()
{
return printer.PrinterName;
}
public PrinterStatusEventArgs GetStatus()
{
return printer.Status;
}
public void Print(List<BaseInstruction> instructions)
{
var commands = new List<byte[]>();
foreach (var instruction in instructions)
{
commands.AddRange(instruction.GetInstructions());
}
printer.Write(ByteSplicer.Combine(commands.ToArray()));
}
}