Aspose.BarCode.Examples.CSharp.CreateAndManageTwoDBarcodes.UseEncodeModeDatamatrixbarcode.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_CreateAndManage2DBarCodes();
            string gtin = "898978777776665655";
            string uid = "121212121212121212";
            string batch = "GH768";
            string expDate = "150923";
            string textToEncode = gtin + uid + batch + expDate; // Or  "(01)"+ gtin + "(..)"+ uid + ...
            string textToDisplay = "GTIN:" + gtin + "\nUID:" + uid + "\nBatch:" + batch + "\nExp.Date:" + expDate;

            // Instantiate barcode object and set N order to avoid including all the names into the codetext, the property called "Display2DText" should be used.            
            BarCodeBuilder builder = new BarCodeBuilder("textToEncode", EncodeTypes.DataMatrix);
            builder.Display2DText = textToDisplay;
            builder.CodeLocation = CodeLocation.Right;
            builder.Margins = new MarginsF(0, 0, 0, 0);
          
            // Builder.CodeTextSpace = 0; // Not recommended small space

            // Save the Barcode image
            builder.Save(dataDir + "codetextRightDisplay_out.png" , BarCodeImageFormat.Png);
        }
    }
UseEncodeModeDatamatrixbarcode