Example #1
0
        public static byte[] CreateInvertData(Emulation emulation)
        {
            byte[] data      = Encoding.UTF8.GetBytes("Hello World.\n");
            byte[] dataHalf0 = Encoding.UTF8.GetBytes("Hello ");
            byte[] dataHalf1 = Encoding.UTF8.GetBytes("World.\n");

            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.Append(data);

            builder.AppendInvert(true);
            builder.Append(data);
            builder.AppendInvert(false);
            builder.Append(data);

            builder.AppendInvert(data);
            builder.Append(data);

            builder.AppendInvert(dataHalf0);
            builder.Append(dataHalf1);

            builder.Append(dataHalf0);
            builder.AppendInvert(dataHalf1);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }
Example #2
0
        public override void Append3inchTextReceiptData(ICommandBuilder builder, bool utf8)
        {
            string encoding;
            if (utf8)
            {
                encoding = "UTF-8";

                builder.AppendCodePage(CodePageType.UTF8);
            }
            else
            {
                encoding = "ASCII";

                builder.AppendCodePage(CodePageType.CP998);
            }

            builder.AppendInternational(InternationalType.USA);

            builder.AppendCharacterSpace(0);

            builder.AppendAlignment(AlignmentPosition.Center);

            builder.Append(Encoding.GetEncoding(encoding).GetBytes(
                            "Star Clothing Boutique\n" +
                            "123 Star Road\n" +
                            "City, State 12345\n" +
                            "\n"));

            builder.AppendAlignment(AlignmentPosition.Left);

            builder.Append(Encoding.GetEncoding(encoding).GetBytes(
                            "Date:MM/DD/YYYY                    Time:HH:MM PM\n" +
                            "------------------------------------------------\n" +
                            "\n"));

            builder.AppendEmphasis(Encoding.GetEncoding(encoding).GetBytes("SALE\n"));

            builder.Append(Encoding.GetEncoding(encoding).GetBytes(
                            "SKU               Description              Total\n" +
                            "300678566         PLAIN T-SHIRT            10.99\n" +
                            "300692003         BLACK DENIM              29.99\n" +
                            "300651148         BLUE DENIM               29.99\n" +
                            "300642980         STRIPED DRESS            49.99\n" +
                            "300638471         BLACK BOOTS              35.99\n" +
                            "\n" +
                            "Subtotal                                  156.95\n" +
                            "Tax                                         0.00\n" +
                            "------------------------------------------------\n"));

            builder.Append(Encoding.GetEncoding(encoding).GetBytes("Total                       "));

            builder.AppendMultiple(Encoding.GetEncoding(encoding).GetBytes("   $156.95\n"), 2, 2);

            builder.Append(Encoding.GetEncoding(encoding).GetBytes(
                            "------------------------------------------------\n" +
                            "\n" +
                            "Charge\n" +
                            "156.95\n" +
                            "Visa XXXX-XXXX-XXXX-0123\n" +
                            "\n"));

            builder.AppendInvert(Encoding.GetEncoding(encoding).GetBytes("Refunds and Exchanges\n"));

            builder.Append(Encoding.GetEncoding(encoding).GetBytes("Within "));

            builder.AppendUnderLine(Encoding.GetEncoding(encoding).GetBytes("30 days"));

            builder.Append(Encoding.GetEncoding(encoding).GetBytes(" with receipt\n"));

            builder.Append(Encoding.GetEncoding(encoding).GetBytes(
                            "And tags attached\n" +
                            "\n"));

            builder.AppendAlignment(AlignmentPosition.Center);

            builder.AppendBarcode(Encoding.GetEncoding("ASCII").GetBytes("{BStar."), BarcodeSymbology.Code128, BarcodeWidth.Mode2, 40, true);
        }
        public void AppendDotImpact3inchTextReceiptData(ICommandBuilder commandBuilder, bool utf8)
        {
            Encoding encoding;

            if (utf8)
            {
                encoding = Encoding.UTF8;

                commandBuilder.AppendCodePage(CodePageType.UTF8);
            }
            else
            {
//              encoding = Encoding.ASCII;
                encoding = Encoding.UTF8;

                commandBuilder.AppendCodePage(CodePageType.CP998);
            }

            commandBuilder.AppendInternational(InternationalType.USA);

            commandBuilder.AppendAlignment(AlignmentPosition.Center);

            commandBuilder.Append(encoding.GetBytes("Star Clothing Boutique\n" +
                                                    "123 Star Road\n" +
                                                    "City, State 12345\n" +
                                                    "\n"));

            commandBuilder.AppendAlignment(AlignmentPosition.Left);

            commandBuilder.Append(encoding.GetBytes("Date:MM/DD/YYYY              Time:HH:MM PM\n" +
                                                    "------------------------------------------\n" +
                                                    "\n"));

            commandBuilder.AppendEmphasis(encoding.GetBytes("SALE \n"));

            commandBuilder.Append(encoding.GetBytes("SKU             Description          Total\n" +
                                                    "300678566       PLAIN T-SHIRT        10.99\n" +
                                                    "300692003       BLACK DENIM          29.99\n" +
                                                    "300651148       BLUE DENIM           29.99\n" +
                                                    "300642980       STRIPED DRESS        49.99\n" +
                                                    "300638471       BLACK BOOTS          35.99\n" +
                                                    "\n" +
                                                    "Subtotal                            156.95\n" +
                                                    "Tax                                   0.00\n" +
                                                    "------------------------------------------\n" +
                                                    "Total                              $156.95\n" +
                                                    "------------------------------------------\n" +
                                                    "\n" +
                                                    "Charge\n" +
                                                    "159.95\n" +
                                                    "Visa XXXX-XXXX-XXXX-0123\n" +
                                                    "\n"));

            commandBuilder.AppendInvert(encoding.GetBytes("Refunds and Exchanges\n"));

            commandBuilder.Append(encoding.GetBytes("Within"));

            commandBuilder.AppendUnderLine(encoding.GetBytes(" 30 days"));

            commandBuilder.Append(encoding.GetBytes(" with receipt\n"));
        }