printer-api/PrinterService.cs

37 lines
683 B
C#
Raw Normal View History

2022-02-17 15:45:42 +00:00
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()));
}
}