public static void Run()
        {
            //ExStart:EncodeQRCode

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

            // Instantiate BarCodeBuilder object
            Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder();

            // Set the Code text for the barcode
            builder.CodeText = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

            // Set the symbology type to QR
            builder.EncodeType = Aspose.BarCode.Generation.EncodeTypes.QR;

            // Set the error level
            builder.QRErrorLevel = Aspose.BarCode.QRErrorLevel.LevelQ;

            // Set the QR barcode version number
            builder.QRVersion = Aspose.BarCode.QRVersion.Version10;

            //Save the image
            builder.Save("qr_version10_errorQ.png");

            //ExEnd:EncodeQRCode
        }
        public static void Run()
        {
            // ExStart:ChecksumSupplementData

            // Create an instance of BarCodeBuilder class
            // Set barcode text
            // Set encoding type
            using (Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder("1234567890", Aspose.BarCode.Generation.EncodeTypes.Code128))
            {
                // Set graphic unit
                builder.GraphicsUnit = System.Drawing.GraphicsUnit.Pixel;

                // Call GetMinimumBarCodeSize method to get the minimum size required
                System.Drawing.SizeF minSize = builder.GetMinimumBarCodeSize();

                // Set Auto size to false
                builder.AutoSize = false;

                // Set image height & width with the help of min size got from GetMinimumBarCodeSize method
                builder.ImageWidth  = minSize.Width;
                builder.ImageHeight = minSize.Height;

                // Save the barcode image
                using (System.Drawing.Bitmap image = builder.BarCodeImage)
                    image.Save("minimumresult.png");

                // ExEnd:ChecksumSupplementData
            }
        }
Esempio n. 3
0
        public static void Run()
        {
            // ExStart:ChecksumSupplementData

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

            //Generation
            //Instantiate BarCodeBuilder object
            Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder();

            //Set the Code text for the barcode
            builder.CodeText = "1234567890";

            //Set the symbology type to Code128
            builder.EncodeType = Aspose.BarCode.Generation.EncodeTypes.Codabar;

            //Set the EnableChecksum property to yes
            builder.EnableChecksum = Aspose.BarCode.EnableChecksum.Yes;

            //Set the CodabarChecksumMode
            builder.CodabarChecksumMode = Aspose.BarCode.CodabarChecksumMode.Mod10;

            //Save the image on the system
            builder.Save("Codabar_Mod10.png");

            //Recognition
            //Initialize reader object
            using (Aspose.BarCode.BarCodeRecognition.BarCodeReader reader = new Aspose.BarCode.BarCodeRecognition.BarCodeReader("Codabar_Mod10.png", Aspose.BarCode.BarCodeRecognition.DecodeType.Codabar))
            {
                //Set ChecksumValidation property of the reader to On
                reader.ChecksumValidation = Aspose.BarCode.BarCodeRecognition.ChecksumValidation.On;
                while (reader.Read())
                {
                    //Get code text
                    Console.WriteLine("{0}:{1}", reader.GetCodeType(), reader.GetCodeText());

                    //Get checksum value
                    Console.WriteLine("Checksum:" + reader.GetCheckSum());
                }
            }


            // ExEnd:ChecksumSupplementData
        }
        public static void Run()
        {
            //ExStart:CreateEnCodeDatamatrixBarCode

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

            // Create an instance of BarCodeBuilder class
            // Set codetext value and EncodeType
            Aspose.BarCode.BarCodeBuilder buidler = new Aspose.BarCode.BarCodeBuilder("abcdef123456", Aspose.BarCode.Generation.EncodeTypes.DataMatrix);

            // Set the DataMatrix encoding mode to Text encodation scheme
            buidler.DataMatrixEncodeMode = Aspose.BarCode.DataMatrixEncodeMode.Text;

            // Save the barcode image
            buidler.Save("dataMatrixText.png");

            //ExEnd:CreateEnCodeDatamatrixBarCode
        }
        public static void Run()
        {
            // ExStart:ChecksumSupplementData

            //Instantiate BarCodeBuilder object
            Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder();

            //Set the Code text for the barcode
            builder.CodeText = "(01)98898765432106(3202)012345(15)991231";

            //Set the symbology type to Code128
            builder.EncodeType = Aspose.BarCode.Generation.EncodeTypes.DatabarExpandedStacked;

            //Set the cloumn property to define segments per row
            builder.Columns = 6;

            //Save the image
            builder.Save("6segmets.png");

            // ExEnd:ChecksumSupplementData
        }
Esempio n. 6
0
        public static void Run()
        {
            // ExStart:ChecksumSupplementData

            // Create an instance of BarCodeBuilder class
            // Set barcode text
            // Set encoding type

            //using (Aspose.BarCode.BarCodeBuilder barCodeBuilder = new Aspose.BarCode.BarCodeBuilder("12345678", Aspose.BarCode.Generation.EncodeTypes.Postnet))
            using (Aspose.BarCode.BarCodeBuilder barCodeBuilder = new Aspose.BarCode.BarCodeBuilder("12345678", Aspose.BarCode.Generation.EncodeTypes.AustraliaPost))
            {
                // Set barcode Dimension and height
                barCodeBuilder.xDimension = 1f;
                barCodeBuilder.BarHeight  = 40;

                // Save the barcode image
                barCodeBuilder.Save("postnet.png");
            }

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

            // Create an instance of BarCodeBuilder class
            // Set the barcode text
            // Set the barcode symbology
            using (Aspose.BarCode.BarCodeBuilder builder = new Aspose.BarCode.BarCodeBuilder("123456789012", Aspose.BarCode.Generation.EncodeTypes.EAN13))
            {
                // Generate Barcode image and store it in a Bitmap
                using (System.Drawing.Bitmap barcode = builder.GenerateBarCodeImage())
                {
                    // Load the logo/other image as Bitmap
                    using (System.Drawing.Bitmap picture = (System.Drawing.Bitmap)System.Drawing.Image.FromFile(@"path_to_your_picture.png"))
                    {
                        // Create a new empty image with new Calculated height & width
                        using (System.Drawing.Bitmap output = new System.Drawing.Bitmap(System.Math.Max(barcode.Width, picture.Width), barcode.Height + picture.Height))
                        {
                            // Get the Graphics object
                            using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(output))
                            {
                                // Clear the canvas
                                g.Clear(System.Drawing.Color.White);

                                // Draw the primary image (barcode image) on the canvas
                                g.DrawImage(picture, new System.Drawing.PointF(0, 0));

                                // Draw the second image (logo image) on the canvas inside the barcode image
                                g.DrawImage(barcode, new System.Drawing.PointF(0, picture.Height));
                            }
                            output.Save("output.jpg");
                        }
                    }
                }
            }

            // ExEnd:CreateAztecbarcode
        }