Getting ArgumentOutOfRangeException when trying to set XDimension

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v7)  /  Getting ArgumentOutOfRangeException when trying to set XDimension

DynamicPDF CoreSuite for .NET (v7) Forum

I am getting ArgumentOutOfRangeException when I am trying to set the XDimension. How can I resolve it?

The sample code is following

ceTe.DynamicPDF.Page page = new ceTe.DynamicPDF.Page(ceTe.DynamicPDF.PageSize.Letter, ceTe.DynamicPDF.PageOrientation.Portrait, 54);

string codevalue = "DA2019-04-0412067";
ceTe.DynamicPDF.PageElements.BarCoding.Code128 BarCode = new ceTe.DynamicPDF.PageElements.BarCoding.Code128(codevalue, 50, 50, 50);
BarCode.XDimension = BarCode.XDimension * 100 / BarCode.GetSymbolWidth();
page.Elements.Add(BarCode);

ceTe.DynamicPDF.Document document = new ceTe.DynamicPDF.Document();
document.Pages.Add(page);
document.Draw(@"C:\file.pdf");

call stack:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.Collections.BitArray.Set(Int32 index, Boolean value)
at zz93.qd.a(Byte A_0, Single& A_1)
at zz93.qd.b()
at ceTe.DynamicPDF.PageElements.BarCoding.Code128.DrawBarCode(PageWriter writer)
at ceTe.DynamicPDF.PageElements.Group.Draw(PageWriter writer)
at ceTe.DynamicPDF.Page.c(PageWriter A_0)
at ceTe.DynamicPDF.Page.DrawEntries(DocumentWriter writer, Int32 pageNumber, Int32 sectionPageNumber)
at ceTe.DynamicPDF.Page.a(DocumentWriter A_0, Int32 A_1, Int32 A_2, Int32 A_3)
at zz93.pu.d(Int32 A_0)
at zz93.pu.r()
at ceTe.DynamicPDF.Document.Draw(Stream stream)
at ceTe.DynamicPDF.Document.Draw(String filePath)

Posted by a ceTe Software moderator
Hello,

We did testing on our end and able to create PDF by adding the barcode using the exact code sample posted on the forum. Please try using the latest v7.0.3.27097 build of DynamicPDF for .NET product DLL file in your application. You can download latest v7 DynamicPDF DLL file by logging into our  CustomerArea using your version 7 DynamicPDF product serial number. Once you install the latest version 7 product then remove reference for the older DLL file and reference the latest in your application. Compile and build the application.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 1:34 AM.