/// <summary> /// Constuct a ^FD (Field Data) element, together with the ^FO, ^A and ^FH.Control character will be handled (Conver to Hex or replace with ' ') /// </summary> /// <param name="text">Original text content</param> /// <param name="positionX"></param> /// <param name="positionY"></param> /// <param name="fontWidth"></param> /// <param name="fontHeight"></param> /// <param name="fontName"></param> /// <param name="orientation"></param> /// <param name="useHexadecimalIndicator"></param> public ZPLTextField(string text, int positionX, int positionY, ZPLFont font, NewLineConversionMethod newLineConversion = NewLineConversionMethod.ToSpace, bool useHexadecimalIndicator = true, bool reversePrint = false) : base(positionX, positionY) { Text = text; Origin = new ZPLOrigin(positionX, positionY); Font = font; UseHexadecimalIndicator = useHexadecimalIndicator; NewLineConversion = newLineConversion; ReversePrint = reversePrint; }
public ZplSingleLineFieldBlock( string text, int positionX, int positionY, int width, ZplFont font, TextJustification textJustification = TextJustification.Left, NewLineConversionMethod newLineConversion = NewLineConversionMethod.ToSpace, bool useHexadecimalIndicator = true, bool reversePrint = false) : base(text, positionX, positionY, width, font, 9999, 9999, textJustification, 0, newLineConversion, useHexadecimalIndicator, reversePrint) { }
internal static string SanitizeCharacter( char input, NewLineConversionMethod newLineConversion = NewLineConversionMethod.ToSpace, bool useHexadecimalIndicator = true) { if (useHexadecimalIndicator) { //Convert to hex switch (input) { case '_': case '^': case '~': return("_" + Convert.ToByte(input).ToString("X2")); case '\\': return(" "); } } else { //The field data can be any printable character except those used as command prefixes(^ and ~). //Replace '^', '~' switch (input) { case '^': case '~': case '\\': return(" "); } } if (input == '\n') { switch (newLineConversion) { case NewLineConversionMethod.ToEmpty: return(""); case NewLineConversionMethod.ToSpace: return(" "); case NewLineConversionMethod.ToZplNewLine: return(@"\&"); } } return(input.ToString()); }
/// <summary> /// Construct a ^FD (Field Data) element, together with the ^FO, ^A and ^FH. /// Control character will be handled (Convert to Hex or replace with ' ') /// </summary> /// <param name="text">Original text content</param> /// <param name="positionX"></param> /// <param name="positionY"></param> /// <param name="font"></param> /// <param name="newLineConversion"></param> /// <param name="useHexadecimalIndicator"></param> /// <param name="reversePrint"></param> /// <param name="bottomToTop"></param> public ZplTextField( string text, int positionX, int positionY, ZplFont font, NewLineConversionMethod newLineConversion = NewLineConversionMethod.ToSpace, bool useHexadecimalIndicator = true, bool reversePrint = false, bool bottomToTop = false) : base(positionX, positionY, bottomToTop) { Text = text; Font = font; UseHexadecimalIndicator = useHexadecimalIndicator; NewLineConversion = newLineConversion; ReversePrint = reversePrint; }
public ZplTextBlock( string text, int positionX, int positionY, int width, int height, ZplFont font, NewLineConversionMethod newLineConversion = NewLineConversionMethod.ToSpace, bool useHexadecimalIndicator = true) : base(text, positionX, positionY, font, newLineConversion, useHexadecimalIndicator) { Width = width; Height = height; if (newLineConversion == NewLineConversionMethod.ToZplNewLine) { throw new NotSupportedException("ToZplNewLine is not supported, use ZplFieldBlock"); } }
public ZplFieldBlock( string text, int positionX, int positionY, int width, ZplFont font, int maxLineCount = 1, int lineSpace = 0, TextJustification textJustification = TextJustification.Left, int hangingIndent = 0, NewLineConversionMethod newLineConversion = NewLineConversionMethod.ToZplNewLine, bool useHexadecimalIndicator = true, bool reversePrint = false) : base(text, positionX, positionY, font, newLineConversion, useHexadecimalIndicator, reversePrint) { TextJustification = textJustification; Width = width; MaxLineCount = maxLineCount; LineSpace = lineSpace; HangingIndent = hangingIndent; }
public ZPLTextBlock(string text, int positionX, int positionY, int width, int height, ZPLFont font, NewLineConversionMethod newLineConversion = NewLineConversionMethod.ToSpace, bool useHexadecimalIndicator = true) : base(text, positionX, positionY, font, newLineConversion, useHexadecimalIndicator) { Width = width; Height = height; }