Data Matrix generator

19 Dec 20223 minutes to read

Data Matrix

DataMatrix Barcode is a two dimensional barcode that consists of a grid of dark and light dots or blocks forming square or rectangular symbol. The data encoded in the barcode can either be numbers or alphanumeric. They are widely used in printed media such as labels and letters. You can read it easily with the help of a barcode reader and mobile phones.

@(Html.EJS().DataMatrixGenerator("container").
Width("200px").
Height("150px").
Value("SYNCFUSION").Render() )
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Syncfusion.EJ2.BarcodeGenerator;

namespace EJ2CoreSampleBrowser.Controllers.Barcode
{
    public partial class BarcodeController : Controller
    {
        
        public ActionResult datamatrix()
        {
           
             return View();
        }
    }
}

Customizing the DataMatrix color

A page or printed media with DataMatrix often appears colorful in the background and surrounding region with other contents. In such cases, the DataMatrix can also be customized to suit the needs. You can achieve this by using the forecolor property.

@(Html.EJS().DataMatrixGenerator("container").
Width("200px").
foreColor("red").
Height("150px").
Value("SYNCFUSION").Render() )
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Syncfusion.EJ2.BarcodeGenerator;

namespace EJ2CoreSampleBrowser.Controllers.Barcode
{
    public partial class BarcodeController : Controller
    {
        
        public ActionResult datamatrix()
        {
           
             return View();
        }
    }
}

Customizing the DataMatrix dimension

The dimension of the DataMatrix can be changed using the height and width property of the DataMatrix Generator.

@(Html.EJS().DataMatrixGenerator("container").
Width("300px").
foreColor("red").
Height("300px").
Value("SYNCFUSION").Render() )
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Syncfusion.EJ2.BarcodeGenerator;

namespace EJ2CoreSampleBrowser.Controllers.Barcode
{
    public partial class BarcodeController : Controller
    {
        
        public ActionResult datamatrix()
        {
           
             return View();
        }
    }
}

Customizing the text

In DataMatrix generators, you can customize the DataMatrix text by using the display text property.

@(Html.EJS().DataMatrixGenerator("container").
Width("200px").
foreColor("red").
Height("150px").
DisplayText(s => s.text("text")).
Value("SYNCFUSION").Render() )
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Syncfusion.EJ2.BarcodeGenerator;

namespace EJ2CoreSampleBrowser.Controllers.Barcode
{
    public partial class BarcodeController : Controller
    {
        
        public ActionResult datamatrix()
        {
           
             return View();
        }
    }
}

NOTE

View Sample in GitHub.