Datamatrix

Capable of being read by most mobile phones.
Generally used to label and track small items for inventory.
Has a very low error rate with internal error correction.
Barcode can be square or rectangular in shape.

Demonstration

* 200 character limit for this demo.

<?php
require_once('class/BCGColor.php');
require_once('class/BCGDrawing.php');
require_once('class/BCGdatamatrix.barcode2d.php');

$colorFront = new BCGColor(0, 0, 0);
$colorBack = new BCGColor(255, 255, 255);

// Barcode Part
$code = new BCGdatamatrix();
$code->setScale(3);
$code->setSize(BCGdatamatrix::DATAMATRIX_SIZE_SQUARE);
$code->setErrorLevel(23);

$code->setColor($colorFront, $colorBack);
$code->parse('Datamatrix');

// Drawing Part
$drawing = new BCGDrawing('', $colorBack);
$drawing->setBarcode($code);
$drawing->draw();

header('Content-Type: image/png');

$drawing->finish(BCGDrawing::IMG_FORMAT_PNG);
?>

Technical Specifications

The Datamatrix symbol is an ISO international standard (IEC 16022). You are allowed to use it within your applications.

The Datamatrix code is a 2D barcode that can encode a large amount of information within a square or rectangle symbol. All 256 characters can be encoded.
You may use multiple symbols to spread your information in order to create a bigger message.

This barcode contains a way to detect and correct errors based on the Reed Solomon algorithm. The recovery rate is automatically defined by the barcode size.

Sizes

Table: Size and capacity for a square Datamatrix
Symbol Size Capacity
Row Col Numeric Alphanumeric Byte % of error correction
10 10 6 3 1 62.5
12 12 10 6 3 58.3
14 14 16 10 6 55.6
16 16 24 16 10 50
18 18 36 25 16 43.8
20 20 44 31 20 45
22 22 60 43 28 40
24 24 72 52 34 40
26 26 88 64 42 38.9
32 32 124 91 60 36.7
36 36 172 127 84 32.8
40 40 228 169 112 29.6
44 44 288 214 142 28
48 48 348 259 172 28.1
52 52 408 304 202 29.2
64 64 560 418 277 28.6
72 72 736 550 365 28.1
80 80 912 682 453 29.6
88 88 1152 862 573 28
96 96 1392 1042 693 28.1
104 104 1632 1222 813 29.2
120 120 2100 1573 1047 28
132 132 2608 1954 1301 27.6
144 144 3116 2335 1555 28.5
Table: Size and capacity for a rectangle Datamatrix
Symbol Size Capacity
Row Col Numeric Alphanumeric Byte % of error correction
8 18 10 6 3 58.3
8 32 20 13 8 52.4
12 26 32 22 14 46.7
12 36 44 31 20 45
16 36 64 43 30 42.9
16 48 98 72 47 36.4

Details

Datamatrix barcodes are separated into regions. Smaller barcodes contain only 1 region, but barcodes 32x32 and bigger contain 4, 16, or 36 regions.

1 region of data
4 regions of data
rectangle code

There are many types of encoding Datamatrix can support.
Consider staying in one type of encoding instead of switching back and forth between encodings. This will allow your barcode to stay smaller because it takes a certain amount of bits to switch between encodings. Barcode Bakery will try to generate the smallest barcode possible when you provide data to the parse method.
For instance, it is preferable that you write only lowercase letters or capital letters but not switch back and forth between those two letter types.
The table below represents the bits per character depending on the encodation scheme.

Table: Encodation scheme and size
Encodation scheme Characters Bits per data character
ASCII Double digit numerics 4
ASCII values 0 - 127 8
Extended ASCII values 128 - 255 16
C40 Upper-case alphanumeric 5.33
Lowercase and special characters 10.66
Text Lowercase alphanumeric 5.33
Upper-case and special characters 10.66
X12 ANSI X12 EDI data set ([A-Z0-9], *> and <CR>) 5.33
EDIFACT ASCII values 32 - 94 6
Base 256 All byte values 0 - 255 8

Our barcode generator follows the ECC 200 standard, which is recommended by the ISO standard.

Barcode Bakery Supports

Supports
Encodes Characters, Numbers, Binary Available
Encodes on many codes (Structured Append) Available
Extended Channel Interpretation (Arabic, Hebrew, etc.) Available
Encodes FNC1 Available
Encodes Macro Available
Encodes ECC0-140 *
Specific to .NET package
.NET 2.0+ Available
* ECC0-140 is an old technology and it is not used in industry anymore.