protected override int GetFieldY(Label label, PrintInfo printInfo) { int y; var fontSize = printInfo.ToDotY(string.IsNullOrEmpty(FontSize) ? label.FontSize : FontSize); var kerning = 0; var textBlockHeight = Content.Count() * (fontSize + kerning); switch (VerticalAlignment) { case VerticalAlignment.Bottom: y = (int)printInfo.LabelHeightDots - printInfo.ToDotY(MarginBottom) - textBlockHeight; break; case VerticalAlignment.Center: var marginTop = printInfo.ToDotY(MarginTop); var marginBottom = printInfo.ToDotY(MarginBottom); y = marginTop + (((int)printInfo.LabelHeightDots - marginBottom - marginTop) / 2); y -= (textBlockHeight / 2); break; // Default to .Top default: y = printInfo.ToDotY(MarginTop); break; } return(y); }
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()); }
private string Generate_CODE_128(PrintInfo printInfo) { var o = "N"; // Orientation var h = printInfo.ToDotY(Size); // Height / dots var f = "Y"; // Print interpretation line var g = "N"; // Print interpretation line above code var e = "N"; // UCC Check digit var m = "N"; // Mode return($"^BC{o},{h},{f},{g},{e},{m}^FD{Content}"); }
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 GetFieldY(Label label, PrintInfo printInfo) { return(printInfo.ToDotY(MarginTop)); }