コード例 #1
0
        public static PrintableBuilder SetFont(this PrintableBuilder builder, FontMode fontMode = FontMode.FontA)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.Add(new SetFont(fontMode)));
        }
コード例 #2
0
        public static PrintableBuilder SetCodePage(this PrintableBuilder builder, byte codePage)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.Add(new SetCodePage(codePage)));
        }
コード例 #3
0
        public static PrintableBuilder Feed(this PrintableBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.Add(new Feed()));
        }
コード例 #4
0
        public static PrintableBuilder Cut(this PrintableBuilder builder, CutType type = CutType.Partial)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.Add(new Cut(type)));
        }
コード例 #5
0
        public static PrintableBuilder SetJustification(this PrintableBuilder builder,
                                                        JustificationType justificationType = JustificationType.Left)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.Add(new SetJustification(justificationType)));
        }
コード例 #6
0
        public static PrintableBuilder AddTextLine(this PrintableBuilder builder, string content = "",
                                                   CodePage codePage = CodePage.Default, Encoding encoding = null, bool feed = true)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.Add(new TextLine(content, codePage, encoding, feed)));
        }
コード例 #7
0
        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());
        }
コード例 #8
0
        public static PrintableBuilder AddBarcode(this PrintableBuilder builder, string content = "", int height = 32,
                                                  BarcodeType barcodeType = BarcodeType.Code128)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            return(builder.Add(new Barcode(content, height, barcodeType)));
        }