We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Datamatrix Encoding Problem

I just downloaded the barcode package to evaluate it for purchase. We are currently using libdmtx and I was running some of the unit tests that resulted in failures with it and have duplicated a couple of the problems in your library (but most passed). These seem particular to rectangular datamatrix barcodes (and probably X12). Changing the matrix size doesn’t affect the results, but the barcode text does. If the problem is similar, I think it had to do something with the string length and encoding boundaries.

If there is a better way to generate rectangular datamatrix barcodes, please let me know. Otherwise, I hope this test helps:

        var barcodeContent = "1>35>LAQ>5";

        var generator = new BarcodeGenerator(EncodeTypes.DataMatrix, barcodeContent);
        generator.Parameters.Barcode.XDimension.Millimeters = 1f;
        generator.Parameters.Barcode.DataMatrix.DataMatrixEncodeMode = DataMatrixEncodeMode.ANSIX12;
        generator.Parameters.Barcode.DataMatrix.DataMatrixEcc = DataMatrixEccType.Ecc200;
        generator.Parameters.Barcode.DataMatrix.Rows = 16;
        generator.Parameters.Barcode.DataMatrix.Columns = 48;

        // Save the image to your system and set its image format to Jpeg
        using (var ms = new MemoryStream())
            generator.Save(ms, BarCodeImageFormat.Tiff);

            using (var reader = new BarCodeReader(ms))
                var results = reader.ReadBarCodes();
                Assert.AreEqual(1, results.Length);
                Assert.AreEqual(barcodeContent, results[0].CodeText);


Thanks for the sample code and details.

Please notice, we were able to reproduce the issue as you mentioned via your unit test. The issue seems to be related to rectangular DataMatrix barcode as it does affect the barcode text or the text is wrong. We have logged a ticket with an id “BARCODENET-37637” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

Ok, there are bug in generation of X12 and EDIFACT encodings for Datamatrix, currently we are fixing issues.


This is to inform you that we have fixed your issue now. Our upcoming next release (Aspose.BarCode for .NET v20.9) will include the fix.