Exemple #1
0
        protected override string GetFieldContent(Label label, PrintInfo printInfo)
        {
            var zpl = new StringBuilder();

            // Set font options
            if (!string.IsNullOrEmpty(FontSize))
            {
                zpl.Append($"^CF{Font},{printInfo.ToDotY(FontSize)}");
            }
            else
            {
                zpl.Append($"^CF{label.Font},{printInfo.ToDotY(label.FontSize)}");
            }

            int    width         = (int)printInfo.LabelWidthDots - printInfo.ToDotX(MarginLeft) - printInfo.ToDotX(MarginRight);
            int    maxLines      = Content.Count();
            int    kerning       = 0;
            string justify       = GetJustification(HorizontalAlignment);
            int    hangingIndent = 0;

            // Field Block
            zpl.Append($"^FB{width},{maxLines},{kerning},{justify},{hangingIndent}");

            // Field Data
            zpl.Append($"^FD");
            zpl.Append(string.Join("\\&", Content.Select(c => c.Content)));

            return(zpl.ToString().Trim());
        }
        protected override string GetFieldContent(Label label, PrintInfo printInfo)
        {
            var width     = printInfo.LabelWidthDots - printInfo.ToDotX(MarginRight) - printInfo.ToDotX(MarginLeft);
            var height    = printInfo.LabelHeightDots - printInfo.ToDotY(MarginTop) - printInfo.ToDotY(MarginBottom);
            var thickness = printInfo.PointToDot(Convert.ToDouble(Thickness.Replace("pt", "")));
            var zpl       = new StringBuilder();
            var c         = BorderColor == BorderColor.Black ? "B" : "W";

            zpl.Append($"^GB{width},{height},{thickness},{c},{BorderRounding}");

            return(zpl.ToString().Trim());
        }
 protected override int GetFieldX(Label label, PrintInfo printInfo)
 {
     return(printInfo.ToDotX(MarginLeft));
 }