Concatenate with fileName example

All the documentation I am finding shows how to concatenate pdf files as stream objects. Then the forums suggest it is more efficient to use filename strings. Is there a code sample somewhere showing this?

My issue is actually I need to be able to use an array of files but do not know how many there will be until after I loop through a dataset. I need to be able to create the arraylist dynamically and then feed that to the concatenate method.

Thanks!

Hello Eva,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

Please visit the following link and you will find code snippet to concatenate Pdf files, using filenames as strings. Try using public bool Concatenate(string,string,string); method which takes files names as string.

According to your requirement, please try using the following code snippet, to traverse and read all the files in a particular folder, at runtime.

[C#]

DataTable PDFFiles = GetDataTable();
string[] fileNames = new string[PDFFiles.Rows.Count];
for (int i = 0; i <= (PDFFiles.Rows.Count - 1); i++)

{
fileNames[i] = PDFFiles.Rows[i].ItemArray[0].ToString();
}

string date = DateTime.Now.ToString("yyyyMMdd");
string hoursSeconds = DateTime.Now.ToString("hhmmss");
string milliSeconds = DateTime.Now.Millisecond.ToString();
string masterFileName = date + hoursSeconds + milliSeconds + ".pdf";
Aspose.Pdf.Kit.PdfFileEditor pdfEditor = new PdfFileEditor();

pdfEditor.Concatenate(fileNames, (@"C:\pdftest\AsposeTimeout\AsposeTimeout\AsposeTimeout\") + "\\" + masterFileName);

}

private DataTable GetDataTable()|
{
DataTable tbl = new DataTable();
DataColumn col = new DataColumn("path");
tbl.Columns.Add(col);

for (int i = 0; i < 72; i++)
{

DataRow row = tbl.NewRow();
row["path"] = string.Format(@"C:\pdftest\AsposeTimeout\AsposeTimeout\AsposeTimeout\" + "Copy ({0}) of Sample.pdf", i);
tbl.Rows.Add(row);

}
return tbl;
}

Thanks. You gave me enough here that I was able to alter my code and use the string method instead.