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 static PrintableBuilder SetDoubleFont(this PrintableBuilder builder) => builder.SetFont(FontMode.DoubleWidth | FontMode.DoubleHeight);
public static PrintableBuilder SetEmphasizedFont(this PrintableBuilder builder) => builder.SetFont(FontMode.Emphasized);
public static PrintableBuilder SetFontB(this PrintableBuilder builder) => builder.SetFont(FontMode.FontB);
public static PrintableBuilder SetFontA(this PrintableBuilder builder) => builder.SetFont();