Aspose.BarCode.Examples.CSharp.ManageBarCodes.ManageCaption.Run C# (CSharp) Method

Run() public static method

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

            // Instantiate barcode object and set CodeText & Barcode Symbology
            BarCodeBuilder barCodeBuilder = new BarCodeBuilder("1234567", EncodeTypes.Code128);

            // Create caption object. Set its text and text alignment & also make it visible
            Caption caption = new Caption
            {
                Text = "Aspose.BarCode",
                TextAlign = StringAlignment.Center,
                Visible = true
            };

            // Assign caption object to be displayed above and below the barcode
            barCodeBuilder.CaptionAbove = caption;
            barCodeBuilder.CaptionBelow = caption;

            // Save the image to your system and set its image format to Jpeg
            barCodeBuilder.Save(dataDir + "ManageCaption_out.jpg", ImageFormat.Jpeg);
            Console.WriteLine(Environment.NewLine + "Barcode saved at " + dataDir);
        }
    }
ManageCaption