예제 #1
0
        public static byte[] CreatePdf417Data(Emulation emulation)
        {
            byte[] data;

            data = Encoding.UTF8.GetBytes("Hello World.\n");

            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.Append(Encoding.UTF8.GetBytes("\n*Module:2*\n"));
            builder.AppendPdf417(data, 0, 1, Pdf417Level.ECC0, 2, 2);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Module:4*\n"));
            builder.AppendPdf417(data, 0, 1, Pdf417Level.ECC0, 4, 2);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*Column:2*\n"));
            builder.AppendPdf417(data, 0, 2, Pdf417Level.ECC0, 2, 2);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Column:4*\n"));
            builder.AppendPdf417(data, 0, 4, Pdf417Level.ECC0, 2, 2);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*Line:10*\n"));
            builder.AppendPdf417(data, 10, 0, Pdf417Level.ECC0, 2, 2);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Line:40*\n"));
            builder.AppendPdf417(data, 40, 0, Pdf417Level.ECC0, 2, 2);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*Level:ECC0*\n"));
            builder.AppendPdf417(data, 0, 7, Pdf417Level.ECC0, 2, 2);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Level:ECC8*\n"));
            builder.AppendPdf417(data, 0, 7, Pdf417Level.ECC8, 2, 2);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*AbsolutePosition:40*\n"));
            builder.AppendPdf417WithAbsolutePosition(data, 0, 1, Pdf417Level.ECC0, 2, 2, 40);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*Alignment:Center*\n"));
            builder.AppendPdf417WithAlignment(data, 0, 1, Pdf417Level.ECC0, 2, 2, AlignmentPosition.Center);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Alignment:Right*\n"));
            builder.AppendPdf417WithAlignment(data, 0, 1, Pdf417Level.ECC0, 2, 2, AlignmentPosition.Right);
            builder.AppendUnitFeed(32);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }