Where did SetBinaryCodeText() go?

I am in need of some assistance upgrading the following to the latest nuget v20.3.0. Any help is greatly appreciated. Stuck on SetBinaryCodeText(). Found the xDimension under .parameters.barcode.

protected byte[] EncodeBarCode(string BarCodeText)
{

        //BarCodeBuilder objBarCodeBuilder = new BarCodeBuilder { EncodeType = EncodeTypes.DataMatrix };
        BarcodeGenerator objBarCodeBuilder = new BarcodeGenerator(EncodeTypes.DataMatrix);

       byte[] byteArray = Encoding.Unicode.GetBytes(BarCodeText);

        // OLD CODE objBarCodeBuilder.SetCodeText(byteArray);
        objBarCodeBuilder.SetBinaryCodeText(byteArray);
        objBarCodeBuilder.xDimension = 2;
        objBarCodeBuilder.SupplementData = "some text"; //BarCodeText.Replace("||", "\r\n");
        imgBarcode = objBarCodeBuilder.GenerateBarCodeImage();
        Guid xnam = Guid.NewGuid();

        //save to memorystream
        MemoryStream xStream = new MemoryStream();
        imgBarcode.Save(xStream, System.Drawing.Imaging.ImageFormat.Png);

        return xStream.ToArray();
    }

I think I may have found a solution to this. It appears that I can pass the text into the generate line, then set encoding to full:

BarcodeGenerator objBarCodeBuilder = new BarcodeGenerator(EncodeTypes.DataMatrix, passYourTextParamHere);
objBarCodeBuilder .Parameters.Barcode.DataMatrix.DataMatrixEncodeMode = DataMatrixEncodeMode.Full;

Testing it out today…

@mvgibson,
Sure, you may please take your time to perform your tests and share feedback with us.

Updated code that I am trying to use is as follows, but I am now getting a NullReference exception when calling GenerateBarCodeImage() I am not sure why though. Any ideas?

protected byte[] EncodeBarCode(string BarCodeText)
{
BarcodeGenerator objBarCodeBuilder = new BarcodeGenerator(EncodeTypes.DataMatrix, BarCodeText);
objBarCodeBuilder.Parameters.Barcode.DataMatrix.DataMatrixEncodeMode = DataMatrixEncodeMode.Full;
objBarCodeBuilder.Parameters.Barcode.XDimension.Pixels = 2;
System.Drawing.Bitmap imgBarcode = objBarCodeBuilder.GenerateBarCodeImage();

MemoryStream xStream = new MemoryStream();
imgBarcode.Save(xStream, System.Drawing.Imaging.ImageFormat.Png);

        return xStream.ToArray();
    }

@mvgibson,
I have tried this sample code and no issue is observed. It works fine and no exception is raised while resulting into 905 bytes data. I used following sample code:

BarcodeGenerator objBarCodeBuilder = new BarcodeGenerator(EncodeTypes.DataMatrix, "BarCodeText");
objBarCodeBuilder.Parameters.Barcode.DataMatrix.DataMatrixEncodeMode = DataMatrixEncodeMode.Full;
objBarCodeBuilder.Parameters.Barcode.XDimension.Pixels = 2;
System.Drawing.Bitmap imgBarcode = objBarCodeBuilder.GenerateBarCodeImage();

MemoryStream xStream = new MemoryStream();
imgBarcode.Save(xStream, System.Drawing.Imaging.ImageFormat.Png);

byte[] data =  xStream.ToArray();
imgBarcode.Save(path + "output.png", ImageFormat.Png);

Please give a try using latest version Aspose.BarCode 20.3 and share your feedback.

output.png (468 Bytes)