示例#1
0
        public static byte[] CreateBarcodeData(Emulation emulation)
        {
            byte[] dataUpcE    = Encoding.UTF8.GetBytes("01234500006");
            byte[] dataUpcA    = Encoding.UTF8.GetBytes("01234567890");
            byte[] dataJan8    = Encoding.UTF8.GetBytes("0123456");
            byte[] dataJan13   = Encoding.UTF8.GetBytes("012345678901");
            byte[] dataCode39  = Encoding.UTF8.GetBytes("0123456789");
            byte[] dataItf     = Encoding.UTF8.GetBytes("0123456789");
            byte[] dataCode128 = Encoding.UTF8.GetBytes("{B0123456789");
            byte[] dataCode93  = Encoding.UTF8.GetBytes("0123456789");
            byte[] dataNw7     = Encoding.UTF8.GetBytes("A0123456789B");

            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.Append(Encoding.UTF8.GetBytes("*UPCE*\n"));
            builder.AppendBarcode(dataUpcE, BarcodeSymbology.UPCE, BarcodeWidth.Mode1, 40, true);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*UPCA*\n"));
            builder.AppendBarcode(dataUpcA, BarcodeSymbology.UPCA, BarcodeWidth.Mode1, 40, true);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*JAN8*\n"));
            builder.AppendBarcode(dataJan8, BarcodeSymbology.JAN8, BarcodeWidth.Mode1, 40, true);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*JAN13*\n"));
            builder.AppendBarcode(dataJan13, BarcodeSymbology.JAN13, BarcodeWidth.Mode1, 40, true);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Code39*\n"));
            builder.AppendBarcode(dataCode39, BarcodeSymbology.Code39, BarcodeWidth.Mode1, 40, true);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*ITF*\n"));
            builder.AppendBarcode(dataItf, BarcodeSymbology.ITF, BarcodeWidth.Mode1, 40, true);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Code128*\n"));
            builder.AppendBarcode(dataCode128, BarcodeSymbology.Code128, BarcodeWidth.Mode1, 40, true);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Code93*\n"));
            builder.AppendBarcode(dataCode93, BarcodeSymbology.Code93, BarcodeWidth.Mode1, 40, true);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*NW7*\n"));
            builder.AppendBarcode(dataNw7, BarcodeSymbology.NW7, BarcodeWidth.Mode1, 40, true);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("*HRI:NO*\n"));
            builder.AppendBarcode(dataUpcE, BarcodeSymbology.UPCE, BarcodeWidth.Mode1, 40, false);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("*Mode:1*\n"));
            builder.AppendBarcode(dataUpcE, BarcodeSymbology.UPCE, BarcodeWidth.Mode1, 40, true);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("*Mode:2*\n"));
            builder.AppendBarcode(dataUpcE, BarcodeSymbology.UPCE, BarcodeWidth.Mode2, 40, true);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("*Mode:3*\n"));
            builder.AppendBarcode(dataUpcE, BarcodeSymbology.UPCE, BarcodeWidth.Mode3, 40, true);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*AbsolutePosition:40*\n"));
            builder.AppendBarcodeWithAbsolutePosition(dataUpcE, BarcodeSymbology.UPCE, BarcodeWidth.Mode1, 40, true, 40);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*Alignment:Center*\n"));
            builder.AppendBarcodeWithAlignment(dataUpcE, BarcodeSymbology.UPCE, BarcodeWidth.Mode1, 40, true, AlignmentPosition.Center);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Alignment:Right*\n"));
            builder.AppendBarcodeWithAlignment(dataUpcE, BarcodeSymbology.UPCE, BarcodeWidth.Mode1, 40, true, AlignmentPosition.Right);
            builder.AppendUnitFeed(32);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }