It is a common misconception that a 2-D barcode can hold a large amount of data. In the case of DataMatrix, the limit can be quite small depending on the size of the barcode.
There is a direct relationship between barcode size and data encoded in the barcode. This is true for just about all barcode symbologies. Assuming the size (e.g. mil) of the data elements (x-dimension) stays constant, the more data encoded in the barcode, the larger the barcode will grow.
If the overall size of the barcode must remain constant, but the amount of data is variable, then the size of the data elements (e.g. each line or block) must change. Thus if you increase the amount of data encoded in the barcode, the size of each element inside the barcode must decrease to maintain the size of the overall size of barcode. Likewise decreasing the data encoded in the barcode must cause an increase in element size to maintain the size of the overall barcode.
How much data can a given 2D DataMatrix barcode hold? The following link table provides the data size limitation for DataMatrix barcode.
Reducing the element size of a barcode is subject to limitations when printing and scanning. Generally thermal printers should have at least 300 DPI printing 2D barcode. Also, some scanners will have difficulty reading barcodes with an element size less that 10 mil.