added qrcode
This commit is contained in:
parent
ca3fadde1c
commit
c858e3e9c4
@ -53,6 +53,10 @@ public class PrinterController : Controller
|
||||
case "barcode2d":
|
||||
parsedInstruction = instruction.Deserialize<Barcode2D>();
|
||||
break;
|
||||
case "qrcode":
|
||||
parsedInstruction = instruction.Deserialize<QRCode>();
|
||||
break;
|
||||
|
||||
default:
|
||||
return BadRequest();
|
||||
}
|
||||
|
26
Instructions/QRCode.cs
Normal file
26
Instructions/QRCode.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json.Serialization;
|
||||
using ESCPOS_NET.Emitters;
|
||||
|
||||
public class QRCode : BaseInstruction
|
||||
{
|
||||
[DataMember(IsRequired = true)]
|
||||
public string? data { get; set; }
|
||||
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public TwoDimensionCodeType barcodeType {get; set; } = TwoDimensionCodeType.QRCODE_MODEL2;
|
||||
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public Size2DCode size {get; set; } = Size2DCode.NORMAL;
|
||||
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public CorrectionLevel2DCode correctionLevel {get; set; } = CorrectionLevel2DCode.PERCENT_7;
|
||||
public override List<byte[]> GetInstructions()
|
||||
{
|
||||
var commands = new List<byte[]>();
|
||||
|
||||
commands.Add(e.PrintQRCode(data,barcodeType,size,correctionLevel));
|
||||
|
||||
return commands;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user