I have a piece of vb.net code that performs an append of multiple pdf files into a single one. When I run it in a WinForms app, everything works great. When I run the same code in a console app, I get the error message: 'Error opening PDF document' when trying to open the first document.
The code goes something like this:
'Build an array of files called arrFiles to be concatenated
...
Dim pdfDoc as CDIntf.Document
pdfDoc.Open(arrFiles(0))
For count = 1 to arrFiles.Length-1
pdfDoc.Append(arrFiles(count)
Next
In the console code, the program breaks at the pdfDoc.Open line and the error is
Unhandled Exception: System.Runtime.InteropServices.COMException (0x80004005): Error opening PDF document
at System.RuntimeType.ForwardCallToInvokeMember(String MemberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at CDIntf.DocumentClass.Open(String FileName)
etc.
Any suggestions?
Thanks
Tom
Problem opening document with CDIntf
Hello,
I tested the simple code snippet below and every thing seemed to function correctly.
Sub Main()
Dim pdfDoc As New CDIntfEx.Document
Dim pdfDoc1 As New CDIntfEx.Document
pdfDoc.Open("c:\\temp\\Document1.pdf")
pdfDoc1.Open("c:\\temp\\Document2.pdf")
pdfDoc.AppendEx(pdfDoc1)
pdfDoc.Save("c:\\temp\\Document_console.pdf")
End Sub
Hope this helps?
Thanks,
I tested the simple code snippet below and every thing seemed to function correctly.
Sub Main()
Dim pdfDoc As New CDIntfEx.Document
Dim pdfDoc1 As New CDIntfEx.Document
pdfDoc.Open("c:\\temp\\Document1.pdf")
pdfDoc1.Open("c:\\temp\\Document2.pdf")
pdfDoc.AppendEx(pdfDoc1)
pdfDoc.Save("c:\\temp\\Document_console.pdf")
End Sub
Hope this helps?
Thanks,