Exception when merging PDF Documents

Hi Guys,

i get an Exception when i try to run the following code:

Dim inStream1 As FileStream = File.Open("d:\test\ZKWTEST1.pdf", FileMode.Open, FileAccess.Read, FileShare.Read)

Dim inStream2 As FileStream = File.Open("d:\test\ZKWTEST2.pdf", FileMode.Open, FileAccess.Read, FileShare.Read)

'new a PdfFileEditor object

Dim pdfEditor As PdfFileEditor = New PdfFileEditor

'generate new Pdf file stream.

Dim outStream As IO.FileStream = File.Create("d:\test\result.pdf")

pdfEditor.Concatenate(inStream1, inStream2, outStream)

outStream.Close()

Exception is InvalidCastexception({"The Object of Type xeb116a323308e2f7.xae94bcfc1c7ddd9a connot not be converted to Type xeb116a323308e2f7.x0b25947bdf0fba40 ."}

bei Aspose.Pdf.Kit.PdfFileEditor.Concatenate(Stream firstInputStream, Stream secInputStream, Stream outputStream)
bei WindowsApplication1.Form1.Button2_Click(Object sender, EventArgs e) in C:\Dokumente und Einstellungen\d000001\Lokale Einstellungen\Anwendungsdaten\Temporary Projects\WindowsApplication1\Form1.vb:Zeile 27.
bei System.Windows.Forms.Control.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnClick(EventArgs e)
bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
bei System.Windows.Forms.Control.WndProc(Message& m)
bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
bei System.Windows.Forms.Button.WndProc(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
bei System.Windows.Forms.Application.Run(ApplicationContext context)
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
bei WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Zeile 81.
bei System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Threading.ThreadHelper.ThreadStart()

Thanks for your Help

I am using VB. net 2005 and downloaded the current version of PDF.kit today.

best regards,

Kai Wachter

Hi,
Thank you for considering Aspose.
Please use ConcatenateForms() instead of Concatenate(), which may cause problem when forms are involved. Sorry for inconvenience. Anyway, we developers will try our best to improve the APIs so as to be more friendly to users.

Best Regards,