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

Free Support Forum - aspose.com

Parenthesis in PDF417 CodeText


I have been using a very old version of the BarCode library from back in 2010. I believe it was version 3.7. Although we renew our license periodically, I haven’t updated to a newer version until now since I have had no reason to. Well, now I have a reason since vector graphics are supported and we are utilizing them more in our generated documents.

Anyways, I updated to the latest version 18.11 for .Net and updated my code to use the new BarCodeGenerator. What I found is that when the CodeText of a PDF417 barcode has a closing parenthesis ‘)’, the library throws an error of ‘System.OutOfMemoryException: Array dimensions exceeded supported range.’ The old library did not have this problem and generated the barcode without issue.

This is a snippet of my code.

System.Drawing.Font f = new System.Drawing.Font(“Lucida Console”, 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);

Aspose.BarCode.Generation.BarCodeGenerator b = new Aspose.BarCode.Generation.BarCodeGenerator(Aspose.BarCode.Generation.EncodeTypes.Pdf417);
b.Pdf417.CompactionMode = Aspose.BarCode.Pdf417CompactionMode.Text;
b.Pdf417.ErrorLevel = Aspose.BarCode.Pdf417ErrorLevel.Level2;
b.D2.Columns = 4;
b.D2.Rows = 12;
b.XDimension.Pixels = 3;
b.D2.AspectRatio = 1.33F;
b.CodeTextStyle.Font.FamilyName = f.FontFamily.Name;
b.CodeTextStyle.Alignment = System.Drawing.StringAlignment.Center;
b.CodeTextStyle.Space.Pixels = 5F;
b.CodeTextStyle.Font.Size.Pixels = 12F;
b.CodeTextStyle.Font.Style = System.Drawing.FontStyle.Regular;
b.CodeText = “Sample.Code.Text(Example).20181203_150435”;

MemoryStream barcodeStream = new MemoryStream();
b.Save(barcodeStream, Aspose.BarCode.BarCodeImageFormat.Svg);

Thank you.


Thank you for contacting Aspose Support.
We were able to reproduce the issue that you reported. We have logged a ticket in our issue tracking system as BARCODENET-37045 to investigate this scenario. We will update you here as soon as additional information is available.

The issues you have found earlier (filed as BARCODENET-37045) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by muhammadahmad