Thanks for sharing details and input file(s). I used your code and input file(s) in web application (ASP.NET
) but I am sorry I was unable to get any exception. It generated the output file without throwing any exception. You may check the following code snippet which I used and attached output file.
private void MergeDocuments()<o:p></o:p>
files = Directory.GetFiles(Server.MapPath("Data/Test/"));
int i = 0;
pdf = new Aspose.Pdf.Document(files);
foreach (string file in files)
if (i == 0)
addPdf = new Aspose.Pdf.Document(file);
Moreover, please make sure that you are using valid license and double check that all necessary dll(s) are present in the bin folder of the web application. In case if you still face issue please share details with us i.e OS Version you are running application on, Target Framework of the Application.