We seem to be having issues with merging PDFS. Since updateing the control we get the following 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:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
|
Now beforethe update i would render blank. Here is the code excuted:
Private Function MergePDFs(ByVal strFileNames As String) As String
Dim myDefault As New _Default
Dim strRet As String = myDefault.CreateUniqueName()
Dim arrPdfs() As String = strFileNames.Split("~")
If arrPdfs.Length = 2 Then
Dim strDestPath As String = Server.MapPath("output\") & strRet & ".doc.pdf"
Try
System.IO.File.Copy(arrPdfs(0), strDestPath)
Catch ex As Exception
End Try
Else
Dim strDestPath As String = Server.MapPath("output\") & strRet & ".doc.pdf"
'Creating output stream object that will store the resulting PDF file after appending
Dim outputStream As System.IO.FileStream = New System.IO.FileStream(strDestPath, System.IO.FileMode.Create, IO.FileAccess.Write)
Dim inStreams() As System.IO.Stream
ReDim inStreams(0)
'Instantiating PdfFileEditor object
Dim pdfEditor As Aspose.Pdf.Kit.PdfFileEditor = New Aspose.Pdf.Kit.PdfFileEditor
Dim license As Aspose.Pdf.Kit.License = New Aspose.Pdf.Kit.License
license.SetLicense("Aspose.Total.lic")
Dim i As Int16
Dim blnGotFirst As Boolean = False
For i = 0 To arrPdfs.Length - 1
If arrPdfs(i).Length > 0 Then
If System.IO.File.Exists(arrPdfs(i)) = True Then
If blnGotFirst = True Then
ReDim Preserve inStreams(inStreams.Length)
End If
blnGotFirst = True
Dim inStream1 As System.IO.FileStream = New System.IO.FileStream(arrPdfs(i), IO.FileMode.Open, IO.FileAccess.Read)
inStreams(inStreams.Length - 1) = inStream1
''inStream1.Close()
End If
End If
Next
'Call Concatenate method of PdfFileEditor object to concatenate all input streams into a single output stream
pdfEditor.Concatenate(inStreams, outputStream)
outputStream.Close()
End If
Return strRet
End Function
This is running on Windows 2003 R2 SP2. This code works fine on windows xp sp2. I have checked security logs and do not see any issues. What could be causing this, where canI look, this is driving us nuts. Please advise...
We are running 2.4.2.0 of the Aspose.Pdf.Kit.
Thank you,
Gavin Duffy