Welcome Guest Search | Active Topics | Sign In | Register

namespace for PdfDocument.Merge Options
.Net_jeeper
Posted: Wednesday, April 30, 2014 10:53:49 AM
Rank: Newbie
Groups: Member

Joined: 4/30/2014
Posts: 1
Hello all.
I am having issues with pdfdocument.merge function. I declare my two pdfs that i want to merge. I then dim a variable as new list array and add the pdfs to the array. Next i try to merge the array using the "PdfDocument.Merge function.

Dim PDF1 As New PdfDocument("temp/aLink.pdf")
Dim PDF2 As New PdfDocument("temp/bLink.pdf")
'*****************************
Dim docList As New ArrayList()
'*****************************
'Add some documents into the list
docList.Add(PDF1)
docList.Add(PDF2)
'******************************
'Merge them
Dim mergedDoc As PdfDocument = PdfDocument.Merge(docList.ToArray())

I get an error on this line: Dim mergedDoc As PdfDocument = PdfDocument.Merge(docList.ToArray())
stating "merge is not a member of EO.Pdf.PdfDocument"

can anyone tell me what i am doing wrong or what i need to import in order for this to work.

Thanks In advance!

eo_support
Posted: Wednesday, April 30, 2014 5:06:28 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

Your code doesn't compile because the version of Merge you are trying to call takes an array of PdfDocument object, but you are passing it an array of "Object" because ArrayList.ToArray returns an array of objects.

To return an array of PdfDocument, you have to use the generic class List<T>. It will be something like this:

Code: C#
Dim docList As New List(Of PdfDocument)()


Once you change that your code will compile.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.