Free Support Forum - aspose.com

Combine PDFs - solution worked for years - just broke - help!

Here is the code that is running:

            Aspose.Pdf.License license = new Aspose.Pdf.License();
            license.SetLicense("Aspose.Total.lic");

            Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
            Aspose.Pdf.Document DocToAdd;
            foreach (string file in FileNames)
            { 
                DocToAdd = new Aspose.Pdf.Document(file); //This is throwing an error!!!!
                AppendPDFDocument(DocToAdd, ref doc, CurrentUserID);
            }

            doc.Save(SaveAs);

The error’s stacktrace:

**StackTrace = " at \u000f ​ .\u0002()\r\n at \u000f ​ .\b \u0002()\r\n **
**at Aspose.Pdf.PageCollection.get_Count()\r\n at Aspose.Pdf.PageCollection.\u0002()\r\n **
**at Aspose.Pdf.PageCollection…ctor(Document \u0002)\r\n at Aspose.Pdf.Document.\u0002()\r\n **
at…

This just started happening today. This solution has been in place and is used by many of our apps. It just started failing when combining PDFs. What does this error message mean? It is throwing this error on all new files?

@Stan.Shaw

Such exception may occur if incoming file is corrupted or has damaged file structure. Sadly, we cannot comment further on it without investigating the scenario in detail. Would you please share one of your sample files with which API is raising this exception? We will test the scenario in our environment and address it accordingly.