Problem opening document with CDIntf

If you are a VB developer and have questions about using our products from VB, here is the place to post them.
Post Reply
taber
Posts: 1
Joined: Tue Mar 30 2004

Problem opening document with CDIntf

Post by taber »

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
Jose
Amyuni Team
Posts: 553
Joined: Tue Oct 01 2002
Contact:

Post by Jose »

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,
Post Reply