diff --git a/Controllers/PrinterController.cs b/Controllers/PrinterController.cs index 388b125..478ea99 100644 --- a/Controllers/PrinterController.cs +++ b/Controllers/PrinterController.cs @@ -41,8 +41,8 @@ public class PrinterController : Controller switch (instruction.GetProperty("type").GetString()) { - case "print": - parsedInstruction = instruction.Deserialize(); + case "text": + parsedInstruction = instruction.Deserialize(); break; case "barcode": parsedInstruction = instruction.Deserialize(); diff --git a/Instructions/PrintInstruction.cs b/Instructions/TextInstruction.cs similarity index 69% rename from Instructions/PrintInstruction.cs rename to Instructions/TextInstruction.cs index 679f58f..0355008 100644 --- a/Instructions/PrintInstruction.cs +++ b/Instructions/TextInstruction.cs @@ -1,20 +1,22 @@ -using System.Collections.Generic; -using System.ComponentModel; using System.Runtime.Serialization; using System.Text.Json.Serialization; using ESCPOS_NET.Emitters; -using ESCPOS_NET.Utilities; -public class PrintInstruction : BaseInstruction +public class TextInstruction : BaseInstruction { [DataMember(IsRequired = true)] public string? text { get; set; } + [JsonConverter(typeof(JsonStringEnumConverter))] + public Alignment alignment {get; set; } = Alignment.Left; + public bool newLine { get; set; } = true; public override List GetInstructions() { var e = new EPSON(); var commands = new List(); + + commands.Add(alignmentCommand(alignment)); if (newLine) {