Free Support Forum - aspose.com

Cannot delete document after using PdfFileEditor

Hello,


I am using PdfFileEditorto concatenate two pdf documents as follows:

Aspose.Pdf.Kit.License lic = new Aspose.Pdf.Kit.License();
lic.SetLicense(@“Aspose.Total.lic”);

Aspose.Pdf.License lic1 = new Aspose.Pdf.License();
lic1.SetLicense(@“Aspose.Total.lic”);

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

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

editor.Concatenate(doc1, doc2, outputDoc);
File.Delete(doc1);

This gives an exception when I try to delete one of the original documents:

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)


I’m using Aspose.PDF.Kit version 2010.03.26. This same code works with previous versions of this dll. Has there been some change to this functionality?

Hi James,

I have also noticed this issue with the latest version and logged it as PDFKITNET-15807 in our issue tracking system. Our team will look into this issue and you’ll be updated via this forum thread once it is resolved.

We’re sorry for the inconvenience.
Regards,


Would it be possible to get an estimated time for when this will be fixed, as we have a release cycle coming up.


Thanks for your help. James.

Hi James,

I’m afraid, I can’t share the ETA for this issue at the moment. However, our team is currently working on this issue and we’ll try to resolve this issue the earliest possible.

We’re sorry for the inconvenience.
Regards,

Hi James,

Please add the following lines after the Concatenate method, as a workaround, to resolve this issue at the moment:


editor = null;

GC.Collect();

GC.WaitForPendingFinalizers();

However, we’ll be able to provide you the fix in the component, in our next monthly release due at the end of May 2010.

I hope this resolves your issue. If you have any further questions, please do let us know.
Regards,



Thanks I will use this workaround for now.

Hi, This does not seem to be fixed in the 2010.05.25 release of Aspose.PDF.Kit? Is it going to be in a later release?


Thanks fro your help.

James

Hi James,

You’re right; this issue was not resolved in our latest release. I’m afraid, at the moment, you’ll have to use the workaround we had already shared with you; however, we’ll try to provide a resolution for this issue in our next monthly release.

We’re sorry for the inconvenience.
Regards,

The issues you have found earlier (filed as 15807) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Thanks, I have tested at my end and the issue has been resolved.