|
| 1 | +using System.Collections.Generic; |
| 2 | + |
| 3 | +namespace BinaryKits.Zpl.Label.Elements |
| 4 | +{ |
| 5 | + /// <summary> |
| 6 | + /// Code 93 Barcode |
| 7 | + /// </summary> |
| 8 | + public class ZplBarcode93 : ZplBarcode |
| 9 | + { |
| 10 | + public bool CheckDigit { get; private set; } |
| 11 | + |
| 12 | + /// <summary> |
| 13 | + /// Code 93 Barcode |
| 14 | + /// </summary> |
| 15 | + /// <param name="content"></param> |
| 16 | + /// <param name="positionX"></param> |
| 17 | + /// <param name="positionY"></param> |
| 18 | + /// <param name="height"></param> |
| 19 | + /// <param name="moduleWidth"></param> |
| 20 | + /// <param name="wideBarToNarrowBarWidthRatio"></param> |
| 21 | + /// <param name="fieldOrientation"></param> |
| 22 | + /// <param name="printInterpretationLine"></param> |
| 23 | + /// <param name="printInterpretationLineAboveCode"></param> |
| 24 | + /// <param name="bottomToTop"></param> |
| 25 | + /// <param name="checkDigit"></param> |
| 26 | + public ZplBarcode93( |
| 27 | + string content, |
| 28 | + int positionX, |
| 29 | + int positionY, |
| 30 | + int height = 100, |
| 31 | + int moduleWidth = 2, |
| 32 | + double wideBarToNarrowBarWidthRatio = 3, |
| 33 | + FieldOrientation fieldOrientation = FieldOrientation.Normal, |
| 34 | + bool printInterpretationLine = true, |
| 35 | + bool printInterpretationLineAboveCode = false, |
| 36 | + bool checkDigit = false, |
| 37 | + bool bottomToTop = false) |
| 38 | + : base(content, |
| 39 | + positionX, |
| 40 | + positionY, |
| 41 | + height, |
| 42 | + moduleWidth, |
| 43 | + wideBarToNarrowBarWidthRatio, |
| 44 | + fieldOrientation, |
| 45 | + printInterpretationLine, |
| 46 | + printInterpretationLineAboveCode, |
| 47 | + bottomToTop) |
| 48 | + { |
| 49 | + this.CheckDigit = checkDigit; |
| 50 | + } |
| 51 | + |
| 52 | + ///<inheritdoc/> |
| 53 | + public override IEnumerable<string> Render(ZplRenderOptions context) |
| 54 | + { |
| 55 | + //TODO:Add 'mode' |
| 56 | + |
| 57 | + //^FO100,100 ^ BY3 |
| 58 | + //^BAN,100,Y,N,N |
| 59 | + //^FD123456 ^ FS |
| 60 | + var result = new List<string>(); |
| 61 | + result.AddRange(RenderPosition(context)); |
| 62 | + result.Add(RenderModuleWidth()); |
| 63 | + result.Add($"^BA{RenderFieldOrientation()},{context.Scale(Height)},{RenderPrintInterpretationLine()},{RenderPrintInterpretationLineAboveCode()},{(CheckDigit ? "Y" : "N")}"); |
| 64 | + result.Add($"^FD{Content}^FS"); |
| 65 | + |
| 66 | + return result; |
| 67 | + } |
| 68 | + } |
| 69 | +} |
0 commit comments