added alignment
This commit is contained in:
parent
2e9909129b
commit
b9ef0c93e9
6
Instructions/Alignment.cs
Normal file
6
Instructions/Alignment.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
public enum Alignment
|
||||||
|
{
|
||||||
|
Right,
|
||||||
|
Left,
|
||||||
|
Center
|
||||||
|
}
|
@ -14,6 +14,9 @@ public class BarcodeInstruction : BaseInstruction
|
|||||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||||
public BarcodeCode barcodeCode { get; set; } = BarcodeCode.CODE_B;
|
public BarcodeCode barcodeCode { get; set; } = BarcodeCode.CODE_B;
|
||||||
|
|
||||||
|
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||||
|
public Alignment alignment {get; set; } = Alignment.Left;
|
||||||
|
|
||||||
// [JsonConverter(typeof(JsonStringEnumConverter))]
|
// [JsonConverter(typeof(JsonStringEnumConverter))]
|
||||||
// public BarWidth width { get; set; } = BarWidth.Default;
|
// public BarWidth width { get; set; } = BarWidth.Default;
|
||||||
|
|
||||||
@ -29,6 +32,8 @@ public class BarcodeInstruction : BaseInstruction
|
|||||||
// commands.Add(e.SetBarWidth(width));
|
// commands.Add(e.SetBarWidth(width));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
commands.Add(alignmentCommand(alignment));
|
||||||
|
|
||||||
if (height > 0)
|
if (height > 0)
|
||||||
{
|
{
|
||||||
commands.Add(e.SetBarcodeHeightInDots(height));
|
commands.Add(e.SetBarcodeHeightInDots(height));
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
|
using ESCPOS_NET.Emitters;
|
||||||
|
|
||||||
public abstract class BaseInstruction
|
public abstract class BaseInstruction
|
||||||
{
|
{
|
||||||
@ -6,4 +7,19 @@ public abstract class BaseInstruction
|
|||||||
public string? type { get; set; }
|
public string? type { get; set; }
|
||||||
|
|
||||||
public abstract List<byte[]> GetInstructions();
|
public abstract List<byte[]> GetInstructions();
|
||||||
|
|
||||||
|
protected byte[] alignmentCommand(Alignment alignment){
|
||||||
|
var e = new EPSON();
|
||||||
|
switch (alignment)
|
||||||
|
{
|
||||||
|
case Alignment.Center:
|
||||||
|
return e.CenterAlign();
|
||||||
|
case Alignment.Left:
|
||||||
|
return e.LeftAlign();
|
||||||
|
case Alignment.Right:
|
||||||
|
return e.RightAlign();
|
||||||
|
default:
|
||||||
|
return e.LeftAlign();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user