.Draw method generates error "Index was outside the bounds of the array"

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v8)  /  .Draw method generates error "Index was outside the bounds of the array"

DynamicPDF CoreSuite for .NET (v8) Forum

I'm merging a bunch of documents into 1.

+ Some of the documents have form fillable text boxes, check boxes, etc..
+ One of the documents gets additional PageElements added to it at runtime -- for example, I render a table on the page

It has always worked until recently. Now I'm getting a "Index was outside the bounds of the array." error when trying to execute the .Draw method.

If I comment out the code and don't add the various PageElements, everything works fine. But when I uncomment and try to add the Table and checkboxes -- that's when I run into problems.

I have the latest version and my PDFs are not corrupt.
Posted by a ceTe Software moderator
Hello,

Can you please send over the following details to support@cete.com so we can look into this issue further?

1. Input PDFs used for merging.
2. Code sample which uses static data so we can recreate the error on our end.
3. Full error message along with stack trace.
4. Exact version and build number of the DynamicPDF DLL file. You can get this information in DLL references properties (Version and Description fields) in Visual Studio.

Thanks,
ceTe Software Support Team.
I'll see if I can put something together over the next few days and send it in. I did manage to get things working. Here's what I've found:

1) I was adding a Checkbox control to a Table cell but the .draw method didn't seem to like that. As soon as I took the Checkbox out, my code started working.

I then tried to add my Checkbox to an AreaGroup and then added the AreaGroup to the Table cell. That actually seemed to work.

2) Occasionally, the Table that I am building will need to spill onto an overflow page. So I'm using the Table.GetOverflowRows() method.

The documents that I've added to the merge document were added by using

.Append("file path", MergeOptions.Append);

When I add the additional page to the merge document because of the overflow rows, I was using

.Append("file path", MergeOptions.None);

For some reason, the draw method didn't like that I had changed the merge options. As soon as I changed MergeOptions.None to MergeOptions.Append -- everything started working again.

When I left MergeOptions.None in there, the following error was being thrown on the .draw method -- "Index was outside the bounds of the array."
Posted by a ceTe Software moderator
Hello,

Using AreaGroup is the recommended way of adding certain page elements to table cells.

Glad to know that you found a workaround. When you get a chance, do send us the information we requested in our last post so we can determine the root cause of the error.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 2:35 AM.