- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
Data Matrix, also known as Data Matrix ECC200, is great 2-dimensional matrix barcode to store different data up to 2,335 alphanumeric characters.
Generate and create Data Matrix barcode using Java is one of the functions in OnBarcode's
Barcode for Java Generating Java library (jar file), which supports
generating & printing Data Matrix and 20+ other linear & 2D bar codes in Java application and software.
Data Matrix Generator and Reader library, SDK & application
Data Matrix Generator components and software include
Data Matrix .NET,
Data Matrix C#,
Data Matrix VB.NET,
Data Matrix ASP.NET,
Data Matrix iPhone,
Data Matrix iPad,
Data Matrix Android,
Data Matrix Generator.
This document is providing a detailed Java sample source code about generating Data Matrix barcodes in Java class using
Java Barcode generation component.
Complete Data Matrix custmoization settings is included in
Java Data Matrix generating guide.
Generating Data Matrix barcode in Java class example:
DataMatrix barcode = new DataMatrix(); /* Data Matrix Valid data char set: ASCII values 0 - 127 in accordance with the US national version of ISO/IEC 646 ASCII values 128 - 255 in accordance with ISO 8859-1. These are referred to as extended ASCII. */ barcode.setData("112233445566"); barcode.setDataMode(DataMatrix.M_AUTO); // if your selected format mode doesnot have enough space to encode your data, // the library will choose the right format mode for you automatically. barcode.setFormatMode(DataMatrix.F_10X10); // Set the processTilde property to true, if you want use the tilde character "~" to specify special characters in the input data. Default is false. // 1-byte character: ~ddd (character value from 0 ~ 255) // ASCII (with EXT): from ~000 to ~255 // 2-byte character: ~6ddddd (character value from 0 ~ 65535) // Unicode: from ~600000 to ~665535 // ECI: from ~7000000 to ~7999999 barcode.setProcessTilde(true); // Data Matrix Unit of Measure, pixel, cm, or inch barcode.setUom(IBarcode.UOM_PIXEL); // Data Matrix barcode bar module width (X) in pixel barcode.setX(3f); barcode.setLeftMargin(10f); barcode.setRightMargin(10f); barcode.setTopMargin(10f); barcode.setBottomMargin(10f); // barcode image resolution in dpi barcode.setResolution(72); barcode.drawBarcode("C:\\datamatrix.gif");