print server with new concept
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
using Inspectron.Epson.PrintServer.Printers.Utils;
|
||||
using Inspectron.Epson.PrintServer.Printers.Utils.KitchenReceipt;
|
||||
using Inspectron.Epson.PrintServer.PrintServices;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace Inspectron.Epson.PrintServer.Printers;
|
||||
|
||||
public class TM_U220IITranslated:IPrinter
|
||||
{
|
||||
private readonly EpsonPrinter _printer;
|
||||
private readonly IEpsonPrinter _printer;
|
||||
|
||||
public TM_U220IITranslated(EpsonPrinter printer)
|
||||
public TM_U220IITranslated(IEpsonPrinter printer)
|
||||
{
|
||||
_printer = printer;
|
||||
}
|
||||
@@ -34,11 +36,10 @@ public class TM_U220IITranslated:IPrinter
|
||||
|
||||
public async Task PrintTextAsync(string text)
|
||||
{
|
||||
ReceiptTranslator translator = new ReceiptTranslator();
|
||||
var ast = translator.ParseReceipt(text);
|
||||
KitchenReceiptPrinter printer = new KitchenReceiptPrinter(lineWidth:33,21);
|
||||
var commands = printer.ConvertToCommands((TranslatedKitchenReceipt)ast);
|
||||
foreach (KitchenPrintCommand command in commands)
|
||||
var deserializedReceipt = JsonSerializer.Deserialize<KitchenReceipt>(text);
|
||||
KitchenReceiptConverter translator = new KitchenReceiptConverter(bigLineWidth: 20, lineWidth: 33);
|
||||
var commands = translator.ConvertToPrintCommands(deserializedReceipt);
|
||||
foreach (var command in commands)
|
||||
{
|
||||
await _printer.SetBiggerFontTM220(command.IsBig);
|
||||
await Task.Delay(200);
|
||||
@@ -49,12 +50,7 @@ public class TM_U220IITranslated:IPrinter
|
||||
await _printer.PrintTextAsync(command.Text + "\n");
|
||||
await Task.Delay(200);
|
||||
}
|
||||
//await _printer.PrintTextAsync(text);
|
||||
//var lines = text.Split('\n').Length;
|
||||
//for (int i = 0; i < lines; i++)
|
||||
//{
|
||||
// await Task.Delay(200);
|
||||
//}
|
||||
|
||||
await _printer.FeedLinesAsync(10);
|
||||
await Task.Delay(1000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user