We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cannot delete file after using Aspose.Pdf.Facades.PdfFileEditor


I am using the latest version of Aspose.Pdf.Facades.PdfFileEditor (6.8.0) to concatenate PDF documents. My code is:

Aspose.Pdf.License lic1 = new Aspose.Pdf.License();

Aspose.Pdf.Facades.PdfFileEditor editor = new Aspose.Pdf.
Facades .PdfFileEditor();

string doc1 = @“C:\Test\Doc1.pdf”;
string doc2 = @“C:Test\Doc2.pdf”;
string outputDoc = @“C:\Test\Output.pdf”;

editor.Concatenate(doc1, doc2, outputDoc);

Seemingly at random the line “File.Delete(doc1)” fails due to the following error. This is usually when the File grows above a certain size (20-30 MB approx). Sometimes it will recover then fail again.

This is the same issue that I raised in a previous version and it was resolved then:

System.IO.IOException: The process cannot access the file ‘C:\Test\Doc1.pdf’ because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.Delete(String path)

Has this issue been re-introduced?


Hi James,

Thanks for using our products and sharing the sample source code.

I tested the scenario multiple times with your source code using Aspose.Pdf for .NET v6.8 but unable to find any issue even a single time. During my testing, I used PDF document of size 33 MB. However, this is very difficult for us to figure out the issue which occurs randomly. We would appreciate, if you can provide the PDF document which is creating problem every time. Moreover, we can not log issue without reproducing at our end. Sorry for the inconvenience.

Please feel free to contact support in case you need any further assistance.

Thanks & Regards,

Thank you - I will try to find a PDF that I can reproduce consistently with.