added 2d barcode
This commit is contained in:
parent
f7b41cf647
commit
ca3fadde1c
@ -50,6 +50,9 @@ public class PrinterController : Controller
|
||||
case "feed":
|
||||
parsedInstruction = instruction.Deserialize<FeedInstruction>();
|
||||
break;
|
||||
case "barcode2d":
|
||||
parsedInstruction = instruction.Deserialize<Barcode2D>();
|
||||
break;
|
||||
default:
|
||||
return BadRequest();
|
||||
}
|
||||
|
27
Instructions/Barcode2D.cs
Normal file
27
Instructions/Barcode2D.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text.Json.Serialization;
|
||||
using ESCPOS_NET.Emitters;
|
||||
|
||||
public class Barcode2D : BaseInstruction
|
||||
{
|
||||
[DataMember(IsRequired = true)]
|
||||
public string? data { get; set; }
|
||||
|
||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||
public TwoDimensionCodeType barcodeType {get; set; } = TwoDimensionCodeType.PDF417;
|
||||
|
||||
[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.Print2DCode(barcodeType,data,size,correctionLevel));
|
||||
|
||||
return commands;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user