ArgumentException: Source array was not long enough

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v7)  /  ArgumentException: Source array was not long enough

DynamicPDF CoreSuite for .NET (v7) Forum

I am attempting to create a PDF with a licensed copy of DynamicPdf Merger 7.0.1.40. The code worked fine in Merger 6.x, but it is failing with an exception in the latest version.

I am creating a Table2 with associated columns and rows. The problem seems to occur when I add a FormattedTextArea that contains <sup></sup> tags in the text. If I remove these lines from my code then the PDF is successfully generated:

string text = "test123-test123-test123<sup>1</sup>";
var textArea = new FormattedTextArea(text, 0, 0, 100, 10, FontFamily.Helvetica, 9, false);
row.Cells.Add(textArea);

It is also successful if I remove the "<sup>1</sup>" from the text string.

My code is too complex so I can't send it to you. I tried creating a simpler sample to reproduce the problem but I could not get it to reproduce in the simple solution.

Here is the stack trace that occurs:

[ArgumentException: Source array was not long enough. Check srcIndex and length, and the array's lower bounds.]
   System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable) +0
   ceTe.DynamicPDF.PageElements.FormattedTextArea.a(Int32 A_0, FormattedTextAreaStyle A_1, PageWriter A_2, Single A_3, Int32 A_4, Int32 A_5) +629
   ceTe.DynamicPDF.PageElements.FormattedTextArea.a(PageWriter A_0) +2497
   ceTe.DynamicPDF.PageElements.FormattedTextArea.DrawRotated(PageWriter writer) +2035
   ceTe.DynamicPDF.PageElements.RotatingPageElement.Draw(PageWriter writer) +195
   ceTe.DynamicPDF.PageElements.Cell2.a(nj A_0, Int32 A_1, StructureElement A_2) +5076
   ceTe.DynamicPDF.PageElements.Row2.a(nj A_0, Boolean A_1, Int32 A_2, StructureElement A_3) +2163
   ceTe.DynamicPDF.PageElements.Row2List.a(Int32 A_0, nj A_1, Boolean A_2, StructureElement A_3) +64
   ceTe.DynamicPDF.PageElements.Row2List.b(nj A_0, Boolean A_1, Single A_2, Single A_3, Table2 A_4, Boolean A_5) +3658
   ceTe.DynamicPDF.PageElements.Table2.b(PageWriter A_0) +842
   ceTe.DynamicPDF.PageElements.Table2.DrawRotated(PageWriter writer) +1135
   ceTe.DynamicPDF.PageElements.RotatingPageElement.Draw(PageWriter writer) +195
   ceTe.DynamicPDF.PageElements.Group.Draw(PageWriter writer) +229
   ceTe.DynamicPDF.Page.c(PageWriter A_0) +35
   ceTe.DynamicPDF.Merger.AppendedPage.a(DocumentWriter A_0, Int32 A_1, Int32 A_2) +330
   ceTe.DynamicPDF.Merger.AppendedPage.DrawEntries(DocumentWriter writer, Int32 pageNumber, Int32 sectionPageNumber) +941
   ceTe.DynamicPDF.Page.a(DocumentWriter A_0, Int32 A_1, Int32 A_2, Int32 A_3) +192
   zz93.pq.d(Int32 A_0) +168
   zz93.pq.r() +607
   ceTe.DynamicPDF.Document.Draw(Stream stream) +2413
   ceTe.DynamicPDF.Document.a(HttpRequest A_0, HttpResponse A_1, Boolean A_2, String A_3, Boolean A_4) +390
   ceTe.DynamicPDF.Document.DrawToWeb(String downloadAsFileName, Boolean forceDownload) +74

 --- Proprietary Click event code removed ---

   System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +118
   System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +113
   System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +9
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Posted by a ceTe Software moderator
Hello,

We did some testing on our end and we are not able to recreate the error. Please try using the latest version 7 DynamicPDF dll file in your application and see if it works for you. You can download the latest version 7 DynamicPDF dll files by logging into our CustomerArea using your version 7 product serial number. Remove reference for the old dll file and reference the latest dll file in your application.

If you continue getting the error even after using the latest version 7 DynamicPDF dll file in your application then please send over the following details to our support team so that they can look into it further. Please note that it is difficult to troubleshoot the issue without recreating it on our end.

1.        Sample formatted text which you are passing to the FormattedTextArea.
2.        Dimensions which you are using to set it to the FormattedTextArea.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 3:10 AM.