I’m trying to open a template file to populate some fields before emailing the file to various recipients and I’m getting this error:
Server Error in ‘/’ Application.
--------------------------------------------------------------------------------
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 805: {
Line 806: string templateFilePath = HttpContext.Current.Server.MapPath("~/Forms/ProjectFeedback/ProjectFeedbackForm.pdf");
Line 807: Aspose.Pdf.Document templateFile = new Aspose.Pdf.Document(templateFilePath);
Line 808:
Line 809: FileInfo newPDF = new FileInfo(Path.GetTempFileName());
Source File: C:\Users\UserName\Documents\Visual Studio Projects\PerformanceManagement\Web~Code\ProjectFeedback\DataHelp.cs Line: 807
Stack Trace:
[IndexOutOfRangeException: Index was outside the bounds of the array.]
?..?(Byte[] , ? ) +1990
?..?( , ? ) +791
?..?( , ? ) +3198
?..( , ?& ) +70
?.?.( , ?& ) +340
?.?.?(Int64 , ArrayList ) +393
?.?.?() +1453
?.?..ctor(Stream , String , Boolean ) +776
?.?..ctor(String ) +84
?..?(String ) +47
?.?..ctor(String ) +49
?..?(String ) +47
?..?(String ) +61
?.…ctor(String ) +60
Aspose.Pdf.Document.?(String , String ) +101
Aspose.Pdf.Document…ctor(String filename) +112
PerformanceManagement.ProjectFeedback.DataHelp.BuildPdfTemplateFile(Int32 ProjectFeedbackRequestID, Hashtable ht) in C:\Users\UserName\Documents\Visual Studio Projects\PerformanceManagement\Web~Code\ProjectFeedback\DataHelp.cs:807
PerformanceManagement.ProjectFeedback.DataHelp.SendProjectFeedbackRequestPdfFormByEmail(Int32 ProjectFeedbackRequestID) in C:\Users\UserName\Documents\Visual Studio Projects\PerformanceManagement\Web~Code\ProjectFeedback\DataHelp.cs:791
ABC.Forms.ProjectFeedback.Request.SubmitFeedback_Click(Object sender, EventArgs e) in C:\Users\UserName\Documents\Visual Studio Projects\PerformanceManagement\Web\Forms\ProjectFeedback\Request.aspx.cs:315
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
I’ve attached the PDF template file.
A search of the forums tell me that some Aspose products have had this issue, but fixes were dealt with via a later version. I’m currently running Aspose.PDF v7.7.0.0 which I think is the latest.
On a deadline, so promptness would be much appreciated.
John