Exemple #1
0
        public static void Run()
        {
            //ExStart:FNC1FirstPositionInExtendedMode
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();

            // Create codetext
            QrExtCodetextBuilder lTextBuilder = new QrExtCodetextBuilder();

            lTextBuilder.AddFNC1FirstPosition();
            lTextBuilder.AddPlainCodetext("000%89%%0");
            lTextBuilder.AddFNC1GroupSeparator();
            lTextBuilder.AddPlainCodetext("12345<FNC1>");

            // Generate codetext
            string lCodetext = lTextBuilder.GetExtendedCodetext();

            // Instantiate barcode object and Set Codetext & SymbologyType
            BarCodeBuilder builder = new BarCodeBuilder("1234567890", EncodeTypes.QR);

            // Set encoding mode, error correction level and display text
            builder.QREncodeMode  = QREncodeMode.ExtendedCodetext;
            builder.QRErrorLevel  = QRErrorLevel.LevelL;
            builder.Display2DText = "My Text";

            // Get barcode image Bitmap and Save QR code
            Bitmap lBmp = builder.GenerateBarCodeImage();

            lBmp.Save(dataDir + "FNC1FirstPositionInExtendedMode_out.bmp", ImageFormat.Bmp);
            //ExEnd:FNC1FirstPositionInExtendedMode
        }
Exemple #2
0
        public static void Run()
        {
            //ExStart:FNC1FirstPositionInExtendedMode
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();

            // Create codetext
            QrExtCodetextBuilder lTextBuilder = new QrExtCodetextBuilder();

            lTextBuilder.AddFNC1FirstPosition();
            lTextBuilder.AddPlainCodetext("000%89%%0");
            lTextBuilder.AddFNC1GroupSeparator();
            lTextBuilder.AddPlainCodetext("12345<FNC1>");

            // Generate codetext
            string lCodetext = lTextBuilder.GetExtendedCodetext();

            // Instantiate barcode object and Set Codetext & SymbologyType
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR, "1234567890");

            // Set encoding mode, error correction level and display text
            generator.Parameters.Barcode.QR.QrEncodeMode = QREncodeMode.ExtendedCodetext;
            generator.Parameters.Barcode.QR.QrErrorLevel = QRErrorLevel.LevelL;
            generator.Parameters.Barcode.CodeTextParameters.TwoDDisplayText = "My Text";

            // Get barcode image Bitmap and Save QR code
            Bitmap lBmp = generator.GenerateBarCodeImage();

            lBmp.Save(dataDir + "FNC1FirstPositionInExtendedMode_out.bmp", ImageFormat.Bmp);
            //ExEnd:FNC1FirstPositionInExtendedMode
            Console.WriteLine(Environment.NewLine + "Barcode saved at " + dataDir + "FNC1FirstPositionInExtendedMode_out.bmp");
        }
Exemple #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            int    w   = Convert.ToInt32(TextBox2.Text);
            int    h   = Convert.ToInt32(TextBox3.Text);
            string str = TextBox1.Value;

            lbl.InnerText = str.Length.ToString();
            //var aa = new ServiceReference1.FirmForTMTResponse();

            //create codetext
            QrExtCodetextBuilder lTextBuilder = new QrExtCodetextBuilder();

            lTextBuilder.AddFNC1FirstPosition();
            //lTextBuilder.AddPlainCodetext("000%89%%0");
            lTextBuilder.AddPlainCodetext(str);
            lTextBuilder.AddFNC1GroupSeparator();
            //lTextBuilder.AddPlainCodetext("12345<FNC1>");

            //generate codetext
            string lCodetext = lTextBuilder.GetExtendedCodetext();

            //generate
            BarCodeBuilder builder = new BarCodeBuilder();

            // set its Symbology
            builder.SymbologyType = Symbology.QR;
            // set encoding mode
            builder.QREncodeMode = QREncodeMode.ExtendedCodetext;
            // set error correction level
            builder.QRErrorLevel = QRErrorLevel.LevelL;
            // set code text
            builder.CodeText = lCodetext;
            // set display text
            //builder.Display2DText = "";

            builder.CodeLocation = Aspose.BarCode.CodeLocation.None;

            //builder.AutoSize = false;
            //builder.ImageHeight = 400;
            //builder.ImageWidth = 400;

            // get barcode image Bitmap
            Bitmap lBmp = builder.GenerateBarCodeImage();

            //Bitmap lBmp = builder.GetCustomSizeBarCodeImage(new Size(100, 100), true);
            //Bitmap lBmp = builder.GetOnlyBarCodeImage(1);
            Graphics g1 = Graphics.FromImage(lBmp);

            g1.FillRectangle(Brushes.White, new Rectangle(0, 0, lBmp.Width, 12));

            //Bitmap newlbmp = KiResizeImage(lBmp, w, h);
            // save QR code
            //newlbmp.Save(@"d:\test_qr.png", ImageFormat.Png);
            lBmp.Save(@"d:\test_qr.png", ImageFormat.Png);
        }