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

30 lines
597 B
C#

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
{
[DataMember(IsRequired = true)]
public string? text { get; set; }
public bool newLine { get; set; } = true;
public override List<byte[]> GetInstructions()
{
var e = new EPSON();
var commands = new List<byte[]>();
if (newLine)
{
commands.Add(e.PrintLine(text));
}
else
{
commands.Add(e.Print(text));
}
return commands;
}
}