Esempio n. 1
0
        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());
        }
Esempio n. 2
0
 public static PrintableBuilder SetDoubleFont(this PrintableBuilder builder) =>
 builder.SetFont(FontMode.DoubleWidth | FontMode.DoubleHeight);
Esempio n. 3
0
 public static PrintableBuilder SetEmphasizedFont(this PrintableBuilder builder) =>
 builder.SetFont(FontMode.Emphasized);
Esempio n. 4
0
 public static PrintableBuilder SetFontB(this PrintableBuilder builder) => builder.SetFont(FontMode.FontB);
Esempio n. 5
0
 public static PrintableBuilder SetFontA(this PrintableBuilder builder) => builder.SetFont();