Hi,
I am using the code below to generate a Code128 barcode. When using the default resolution (96 dpi) it seems the CodeTextAlignment ‘Center’ doesn’t work and the CodeText is not centered.
When changing the resolution to 97 dpi, the text actually gets centered correctly but the aspect ratio of the barcode image changes and it becomes much wider.
When changing the resolution to 300 dpi for better quality of the code text the barcode image becomes even wider.
Is this normal behavior?
As a secondary question: Is there a way to adjust/remove the white space below the code text? I can change the margins of barcode easely but not below the code text.
//Instantiate linear barcode object
using (BarCodeBuilder builder = new BarCodeBuilder())
{
builder.GraphicsUnit = System.Drawing.GraphicsUnit.Millimeter;
//Set the Code text for the barcode
builder.CodeText = “6040223579”;
//default resolution
builder.Resolution = new Aspose.BarCode.Resolution(96, 96, ResolutionMode.Graphics);
//Set the symbology type to Code128
builder.SymbologyType = Symbology.Code128;
//Set the rotation angle of the barcode
builder.RotationAngleF = 0;
builder.BarHeight = 4;
builder.yDimension = 4;
//doesn’t work at 96 dpi
builder.CodeTextAlignment = StringAlignment.Center;
builder.CodeLocation = CodeLocation.Below;
builder.CaptionAbove = null;
//Save image to view result
builder.BarCodeImage.Save(@“c:\testtiffbc.tif”, System.Drawing.Imaging.ImageFormat.Tiff);
}
Best Regards