public byte[] GetBytes() { var builder = new PrintableBuilder(); builder .SetCenterJustification() .AddTextLine(CompanyName) .SetFontB() .AddTextLine($"Doc. {CompanyDocument}") .Feed() .Feed() .SetJustification(); foreach (var product in Products) { builder .SetFont() .AddTextLine($"{product.Quantity} x {product.Name}") .SetFontB() .AddTextLine($"${product.PricePerUnit.ToString(CultureInfo.InvariantCulture)} x " + $"{product.Quantity} = ${product.TotalAmount.ToString(CultureInfo.InvariantCulture)}") .Feed(); } builder .SetRightJustification() .SetDoubleFont() .AddTextLine($"Total: ${Products.Sum(e => e.TotalAmount).ToString(CultureInfo.InvariantCulture)}") .Reset() .Feed() .AddBarcode(CompanyName); return(builder.ToArray()); }
public byte[] GetBytes() { var builder = new PrintableBuilder(); var contentBytes = _encoding.GetBytes(_content); builder .Add(new SetCodePage(_codePage)) .Add(contentBytes); if (_feed) { builder.Add(new Feed()); } builder.Add(new SetCodePage(CodePage.Default)); return(builder.ToArray()); }