Index was outside the bounds of the array

Index was outside the bounds of the array

Forum member · Nov 13, 2007
I'm using the latest eval version. I'm attempting to get code below to execute. It does compile for ASP.NET 1.1 within vs2003 though when the page in question loads then I receive the error message define below under ERROR MSG. What am I overlooking? It's failed at the line of code reading Dim MyDocument As MergeDocument = New MergeDocument (strFilePath.ToString) --------------------------------------------- CODE ----------------------------------- Dim options As MergeOptions = New MergeOptions(True) Dim randomGenerator As New Random Dim strNumGenerated As String 'TODO 'Dim MyDocument As MergeDocument = New MergeDocument(MapPath("check.pdf"), options) Dim strFilePath As String = MapPath("check.pdf") Dim MyDocument As MergeDocument = New MergeDocument(strFilePath.ToString) MyDocument.Creator = "creator verbiage" MyDocument.Author = "author verbiage" MyDocument.Title = "titleverbiage Dim mypage As ceTe.DynamicPDF.Page = MyDocument.Pages(0) Session("adobenum") = Nothing strNumGenerated = CStr(randomGenerator.Next(2000, 3000)) MyDocument.Form.Fields("txtnum").Value = strNumGenerated Session("adobenum") = strNumGenerated MyDocument.DrawToWeb() 'MyDocument.DrawToWeb(Me, False) mypage = Nothing MyDocument = Nothing options = Nothing Response.End() --------------------------------------------- ERROR MSG --------------------------------------------- Index was outside the bounds of the array. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array. Source Error: Line 41 Line 39: Dim strFilePath As String = MapPath("check.pdf") Line 40: Line 41: Dim MyDocument As MergeDocument = New MergeDocument(strFilePath.ToString) Line 42: Line 43: MyDocument.Creator = "creator verbiage" Stack Trace: [IndexOutOfRangeException: Index was outside the bounds of the array.] zz93.d0.a(Int32 A_0) zz93.jm.a(d4 A_0) zz93.e..ctor(d4 A_0, jm A_1) ceTe.DynamicPDF.Merger.PdfDocument.g() ceTe.DynamicPDF.Merger.PdfDocument..ctor(h8 A_0, String A_1) ceTe.DynamicPDF.Merger.PdfDocument..ctor(String filePath) ceTe.DynamicPDF.Merger.MergeDocument..ctor(String filePath) he.check_bottom.Page_Load(Object sender, EventArgs e) in C:\CurrentProject\_OCPA\sourcecode\stlucieHomesteadOnline\vs2003\site\Web\check_bottom.aspx.vb:41 System.Web.UI.Control.OnLoad(EventArgs e) System.Web.UI.Control.LoadRecursive() System.Web.UI.Page.ProcessRequestMain()

Re: Index was outside the bounds of the array

Support · Nov 13, 2007
Your code looks fine. I would like to take a look at the PDF that you are referencing on the line that is failing. Can you send an email over to [^a|mailto:support@cete.com|support@cete.com^] (referencing this forum post) with the actual PDF document you are using attached? With that we will be able to look further into the issue and see where the problem lies. Oh, please also mention the exact build number of the assemblies you are using. Thanks, ceTe Software Support Team