Esempio n. 1
0
        public static byte[] CreateQrCodeData(Emulation emulation)
        {
            byte[] data;

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

            ICommandBuilder builder = StarIoExt.CreateCommandBuilder(emulation);

            builder.BeginDocument();

            builder.Append(Encoding.UTF8.GetBytes("*Cell:2*\n"));
            builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.L, 2);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("*Cell:8*\n"));
            builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.L, 8);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("*Level:L*\n"));
            builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.L, 4);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("*Level:M*\n"));
            builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.M, 4);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("*Level:Q*\n"));
            builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.Q, 4);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("*Level:H*\n"));
            builder.AppendQrCode(data, QrCodeModel.No2, QrCodeLevel.H, 4);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*AbsolutePosition:40*\n"));
            builder.AppendQrCodeWithAbsolutePosition(data, QrCodeModel.No2, QrCodeLevel.L, 4, 40);
            builder.AppendUnitFeed(32);

            builder.Append(Encoding.UTF8.GetBytes("\n*Alignment:Center*\n"));
            builder.AppendQrCodeWithAlignment(data, QrCodeModel.No2, QrCodeLevel.L, 4, AlignmentPosition.Center);
            builder.AppendUnitFeed(32);
            builder.Append(Encoding.UTF8.GetBytes("\n*Alignment:Right*\n"));
            builder.AppendQrCodeWithAlignment(data, QrCodeModel.No2, QrCodeLevel.L, 4, AlignmentPosition.Right);
            builder.AppendUnitFeed(32);

            builder.AppendCutPaper(CutPaperAction.PartialCutWithFeed);

            builder.EndDocument();

            return(builder.Commands);
        }