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