I am looping an array list adding each 1 page pdf file to the first pdf file and it works fine. After I run the following code I get an expected output of:
Added C:\My Stuff\File 2.pdf to C:\My Stuff\File 1.pdf
Added C:\My Stuff\File 3.pdf to C:\My Stuff\File 1.pdf
However what is odd is that when I open File1.pdf, it is 4 pages not 3 and in a wierd order.
Page1 is File1 and has a footer of C:\My Stuff\File 1.pdf • 1
Page2 is File3 and has a footer of C:\My Stuff\File 3.pdf • 1
Page3 is File2 and has a footer of C:\My Stuff\File 2.pdf • 2
Page4 is blank and has a footer of C:\My Stuff\File 3.pdf • 2
Code:
ArrayList files = new ArrayList();
files.Add(@"C:\My Stuff\File 1.pdf");
files.Add(@"C:\My Stuff\File 2.pdf");
files.Add(@"C:\My Stuff\File 3.pdf");
string filename1 = "";
foreach (string file in files)
{
if (filename1 == "")
{
filename1 = file;
continue;
}
CombinePdfFiles(filename1, file);
Debug.WriteLine("Added " + file + " to " + filename1);
}
I could inclide the CombinePdfFiles method but it is basically just copied code from the samples. The only thing I am doing different is not creatiing a new file for all the combined reports.
Any ideas?