Spire.Barcode is a professional barcode library specially designed for .NET developers (C#, VB.NET, ASP.NET, .NET Core) and Java developers (J2SE and J2EE) to generate, read and scan 1D & 2D barcodes.

Fri Dec 11, 2015 9:07 am

I'm getting an IndexOutOfRangeException from Spire.Barcode when generating an pdf417 barcode image when Pdf417ECL higher than level7(include level 7). Level1 to level6 works fine.

var setting = new BarcodeSettings();
setting.Type = BarCodeType.Pdf417;
setting.AutoResize = false;
setting.Unit = GraphicsUnit.Display;
setting.X = ModuleWidth;
setting.Y = ModuleHeight;
setting.Pdf417ECL = Pdf417ECL.Level7;
setting.TextMargin = 0;
setting.TopMargin = 0;
setting.BottomMargin = 0;
setting.RightMargin = 0;
setting.LeftMargin = 0;
setting.ShowText = false;
setting.Data = content;
setting.Data2D = content;
setting.DpiX = PageSize.PRINT_DPI;
setting.DpiY = PageSize.PRINT_DPI;
setting.ColumnCount = 2;
BarCodeGenerator generator = new BarCodeGenerator(setting);
Image barcode = generator.GenerateImage();

Is there any constraints setting a high pdf417 ecl level or it's just a bug?

zyf8827
 
Posts: 1
Joined: Fri Dec 11, 2015 8:54 am

Mon Dec 14, 2015 8:11 am

Hi,

Please try the following code.
Code: Select all
var setting = new BarcodeSettings();
setting.Type = BarCodeType.Pdf417;
setting.AutoResize = false;
setting.Unit = GraphicsUnit.Display;
setting.X = ModuleWidth;
setting.Y = ModuleHeight;
setting.Pdf417ECL = Pdf417ECL.Level7;
setting.TextMargin = 0;
setting.TopMargin = 0;
setting.BottomMargin = 0;
setting.RightMargin = 0;
setting.LeftMargin = 0;
setting.ShowText = false;
setting.Data = content;
setting.Data2D = content;
setting.DpiX = PageSize.PRINT_DPI;
setting.DpiY = PageSize.PRINT_DPI;
setting.ColumnCount = 2; setting.RowCount = 1;
BarCodeGenerator generator = new BarCodeGenerator(setting);
Image barcode = generator.GenerateImage();


Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2432
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.BarCode