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

Free Support Forum - aspose.com

UPC-A Barcode - Last Digit Cut-Off and CodeFontSpace

I’m having some trouble with generating a certain size UPC-A barcode. Using the code below, a UPC-A is generated that has the following issues:

1. The right-most digit is being cut-off. Shrinking the font should not be an option because then the numbers within the Barcode would not fill the space there. With AutoSize set to “true”, there is no reason the image size shouldn’t take the font properly into account (it is a purchased font but that should not matter).

2. The CodeTextSpace seems to have no effect on the spacing from the bottom of the barcode lines and the top of the code. It does for other barcode types. The affect for UPC-A makes the whitespace underneath the whole barcode larger, which makes the entire image taller.

BarCodeBuilder b = new BarCodeBuilder(“850006000029”);

b.AutoSize = true;

b.SymbologyType = Symbology.UPCA;

b.CodeTextFont = new Font(“OCR B Std”, 16.0f);

b.CodeTextSpace = 0.5f; // This appears to have no effect

b.GraphicsUnit = GraphicsUnit.Millimeter;

b.xDimension = 0.66f;

b.BarHeight = 45.70f;

b.Resolution = new Resolution(1200.0f, 1200.0f, ResolutionMode.Customized);

b.Save(“sample.png”, BarCodeImageFormat.Png);

Any help looking into these two issues would be greatly appreciated.


Many thanks for contacting Aspose support. We are currently reviewing your issues and will write back to you soon with more updates.

Please be sure to let us know in case there is anything else we could do to help during the interim and we will be glad to assist you.

Hi Tony,

Thank you for being patient. Could you please provide your font file in this forum thread for testing purposes? Please also let us know which Aspose.BarCode version, are you using?

We have tested your sample code against the latest build of Aspose.BarCode for .NET 7.1.0 and our findings are a bit different than you. For example, the leftmost character is cut off instead of the rightmost. Your font file will help us to be more specific.

Note: We noticed an evaluation mark “Aspose” in your provided barcode picture. It’s because you have not applied a valid license. You can get a 30 day temporary license for testing purposes. We recommend our users to always apply a valid license.

Thanks for the quick reply. This is with version 7.1.0, from the NuGet repo. I quickly put the sample code together to get the request to you ASAP, and didn’t tie the license file into the builder. Attached is the sample after applying the license. Same barcode, just without the evaluation mark.

I can’t put the font file publicly into this thread: it’s a commercial font file. I have sent the font file via e-mail to you. If you need it to go to another e-mail address, please let me know.

Hi Tony,

Thank you for providing your font file. We managed to replicate the portrayed problems. We have logged them in our bug tracking system as follows:

BARCODENET-34227 - UPCA barcode encoding, the rightmost digit is cut-off
BARCODENET-34228 - BarCodeBuilder.CodeTextSpace property is not working as expected

Your post has also been linked to these issues. We’ll keep you informed regarding any available updates. We’re sorry for the inconvenience caused.

Hi Tony,

Thank you for being patient. We have a good news for you that the issue ids BARCODENET-34227 and BARCODENET-34228 have now been resolved. If there is no issue in the QA phase, then their fixes will be included in the next version of Aspose.BarCode for .NET 7.2.0. We’ll inform you via this forum thread as soon as the new release is published.

The issues you have found earlier (filed as BARCODENET-34228;BARCODENET-34227) have been fixed in Aspose.BarCode for .NET 7.2.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.