Barcode image size different after upgrade to 19.11.0.0

Aspose Bar Code 19.7.0.0

var bc = new Aspose.BarCode.Generation.BarCodeGenerator(Aspose.BarCode.Generation.EncodeTypes.Code128);

// setup bar code image parameters
bc.AutoSizeMode = Aspose.BarCode.Generation.AutoSizeMode.Interpolation;
bc.Margins.Top.Millimeters = 0;
bc.Margins.Bottom.Millimeters = 0;
bc.Margins.Left.Millimeters = 0;
bc.Margins.Right.Millimeters = 0;
bc.BarCodeWidth.Millimeters = 25;
bc.BarCodeHeight.Millimeters = 4;
bc.CodeText = clssentry.SerialNumber;
bc.CodeTextStyle.Location = CodeLocation.None;
bc.CaptionBelow.Visible = true;

bc.CaptionBelow.Text = clssentry.SerialNumber.ToString();
bc.CaptionBelow.Alignment = StringAlignment.Center;
bc.CaptionBelow.Font.Size.Point = 8;
bc.CaptionBelow.Space.Millimeters = .25F;
bc.Resolution = 200;
Bitmap bmp = bc.GenerateBarCodeImage();
builder.InsertImage(bmp);

Example output bar height is 4cm and image looks fine

image.png (360 Bytes)

Aspose Bar Code 19.11.0.0

var bc = new Aspose.BarCode.Generation.BarcodeGenerator(Aspose.BarCode.Generation.EncodeTypes.Code128);

// setup bar code image parameters
bc.Parameters.Barcode.AutoSizeMode = Aspose.BarCode.Generation.AutoSizeMode.Interpolation;
bc.Parameters.Barcode.Padding.Top.Millimeters = 0;
bc.Parameters.Barcode.Padding.Bottom.Millimeters = 0;
bc.Parameters.Barcode.Padding.Left.Millimeters = 0;
bc.Parameters.Barcode.Padding.Right.Millimeters = 0;
bc.Parameters.Barcode.BarCodeWidth.Millimeters = 25;
bc.Parameters.Barcode.BarCodeHeight.Millimeters = 4;
bc.CodeText = clssentry.SerialNumber;
bc.Parameters.Barcode.CodeTextParameters.Location = Aspose.BarCode.Generation.CodeLocation.None;
bc.Parameters.CaptionBelow.Visible = true;
bc.Parameters.CaptionBelow.Text = clssentry.SerialNumber.ToString();
bc.Parameters.CaptionBelow.Alignment = Aspose.BarCode.Generation.TextAlignment.Center;
bc.Parameters.CaptionBelow.Font.Size.Point = 8;
bc.Parameters.CaptionBelow.Padding.Top.Millimeters = 0.25F;
bc.Parameters.Resolution = 200;

Bitmap bmp = bc.GenerateBarCodeImage();
builder.InsertImage(bmp);

Example output bar height is 4cm and image doesn’t appear

image.png (262 Bytes)

Example output bar height is changed to 8cm and image appears but bar code height is much smaller

image.png (716 Bytes)

@rasvadmin,
I have tried your sample code with Aspose.BarCode for .NET v19.7 but could not compile it with this version. By further downgrading, the version v19.5 compiles it but raises an exception at the following line
Bitmap bmp = bc.GenerateBarCodeImage();

We need the exact previous version which was working fine for your need for our analysis. Please share a runnable console application (complete solution with dll) for our reference. We will use it here to reproduce the scenario for providing further assistance.

Apologies the Barcode version we upgraded from was 19.2.0

It seems to us that the Barcode height parameter is also including the height of the caption which causes the barcde image to be lost when uses the original height of 4mm … or is that just too small a value with the new version.

@rasvadmin,
We need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

BARCODENET-37338 - Barcode image size different after upgrade to 19.11.0.0

@rasvadmin,

In new BarcodeGenerator users have possibility to set either whole image size in autosize mode or set bars height and x-dimension.

These settings:
bc.Parameters.Barcode.BarCodeWidth.Millimeters = 25;
bc.Parameters.Barcode.BarCodeHeight.Millimeters = 4;
define size of whole image including borders, paddings, captions, supplements and codetext.

In order to get image of the same size you need to set BarCodeWidth and BarCodeHeight that include
Since you don’t set border and right/left paddings in order to get image of the same size you need to set BarCodeHeight so it includes CaptionBelow size:
bc.Parameters.Barcode.BarCodeWidth.Millimeters = 25;
bc.Parameters.Barcode.BarCodeHeight.Millimeters = 9.5f;

We have noticed BarCodeWidth and BarCodeHeight are not ideal names for these settings and create confusion. We will rename them in upcoming releases.