public static void Run()
        {
            //ExStart:MultiECIModeInExtendedMode
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_CreateAndManage2DBarCodes();

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

            lTextBuilder.AddECICodetext(ECIEncodings.Win1251, "Will");
            lTextBuilder.AddECICodetext(ECIEncodings.UTF8, "Right");
            lTextBuilder.AddECICodetext(ECIEncodings.UTF16BE, "Power");
            lTextBuilder.AddPlainCodetext(@"t\e\\st");

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

            // Initialize a BarcodeGenerator  class object, Set CodeText, Symbology, Encoding mode, correction level and display text
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR, lCodetext);

            generator.Parameters.Barcode.QR.QrEncodeMode = QREncodeMode.ExtendedCodetext;
            generator.Parameters.Barcode.QR.QrErrorLevel = QRErrorLevel.LevelL;
            generator.CodeText = lCodetext;
            generator.Parameters.Barcode.CodeTextParameters.TwoDDisplayText = "My Text";

            Bitmap lBmp = generator.GenerateBarCodeImage();

            lBmp.Save(dataDir + "MultiECIModeInExtendedMode_out.bmp", ImageFormat.Bmp);
            //ExEnd:MultiECIModeInExtendedMode
            Console.WriteLine(Environment.NewLine + "Barcode saved at " + dataDir + "MultiECIModeInExtendedMode_out.bmp");
        }
        static void Main(string[] args)
        {
            ApplyLicenses();

            Console.WriteLine("Program started");

            #region QR Code BMP Image Generation

            // Initialize a BarcodeGenerator class object and Set CodeText & Symbology Type
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.QR, "12345TEX");
            // Set ForceQR (default) for standard QR and Code text
            generator.Parameters.Barcode.QR.QrEncodeMode = QREncodeMode.Auto;
            generator.Parameters.Barcode.QR.QrEncodeType = QREncodeType.ForceQR;
            generator.Parameters.Barcode.QR.QrErrorLevel = QRErrorLevel.LevelL;
            // Get barcode image Bitmap and Save QR code
            Bitmap lBmp = generator.GenerateBarCodeImage();
            // Save to Stream in BMP format
            MemoryStream memoryStream = new MemoryStream();
            lBmp.Save(memoryStream, ImageFormat.Bmp);
            memoryStream.Position = 0;

            // Or Save to BMP File on Disk
            //lBmp.Save("image.bmp", ImageFormat.Bmp);

            #endregion

            #region Insert Image in Word & Convert to PDF

            // Load DOCX file you want to insert QR Code Image into
            Document        doc     = new Document("input.docx");
            DocumentBuilder builder = new DocumentBuilder(doc);
            builder.MoveToDocumentEnd(); // or move cursor to any Node position
            // Insert QR Code Image from Memory Stream
            builder.InsertImage(memoryStream);
            // Save to PDF
            // doc.Save("output.docx");
            doc.Save("output.pdf");

            #endregion

            Console.WriteLine("Program ended");
            Console.WriteLine("press any key...");
            Console.ReadLine();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            try
            {
                var    license     = new License();
                string licFileName = Path.Combine(
                    System.AppDomain.CurrentDomain.BaseDirectory,
                    //Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Bin"),
                    "Aspose.Total.lic");
                license.SetLicense(licFileName);

                using var barcodeGen = new BarcodeGenerator(EncodeTypes.EAN13, ((long) 93).ToString("d13"));
                var img = barcodeGen.GenerateBarCodeImage();
                barcodeGen.Save("barcode.jpg", BarCodeImageFormat.Jpeg);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                Console.ReadKey();
            }
        }
        public static void Run()
        {
            // ExStart:CreatingWordDocumentWithBarcodeImage
            // For complete examples and data files, please go to https://github.com/aspose-barcode/Aspose.BarCode-for-.NET

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_TechnicalArticles();

            // Create a word document object with Aspose.Words
            Document doc = new Document();

            // Instantiate linear barcode object, Set the Code text and symbology type for the barcode
            BarcodeGenerator generator = new BarcodeGenerator(EncodeTypes.Code39Standard, "1234567");

            // Create builder for document object, Insert the barCode image into document and Save the word document.
            DocumentBuilder builder = new DocumentBuilder(doc);

            builder.InsertImage(generator.GenerateBarCodeImage());
            doc.Save(dataDir + "Myfile_out.doc");
            // ExEnd:CreatingWordDocumentWithBarcodeImage
            Console.WriteLine(Environment.NewLine + "Creating Word Document With BarCode Image Finished.");
        }