Document.save() does not release file handle

Following published code found within this site for appending PDF files together. Aspose Document object does not release the file handle until the application is closed.

Document targetDoc = new Document();
Document inputDoc;
List inputDocs = new List();
inputDocs.Add(“E:/data/s2.pdf”);
inputDocs.Add(“E:/data/HelloWorld.pdf”);

for (int i = 0; i < inputDocs.Count; i++)
{
inputDoc = new Document(inputDocs[i]);
// Add the pages of the source documents to the target document
targetDoc.Pages.Add(inputDoc.Pages);
}
targetDoc.Save(myDir + “merged.pdf”);
DELETE “merged.pdf” FAILS HERE
The file “merged.pdf” is in use by the application. I have also tried to targetDoc.Dispose() and inputDoc.Dispose() but it still holds on to the targetDoc file.

@deisenberg

Thnk you for contacting support.

Would you please specify if you are deleting the file with code or from file explorer. We are able to delete it right after the PDF file is saved on disk, without closing the application. Please ensure using Aspose.PDF for .NET 18.10 in your environment and share respective files with us via Google Drive, Dropbox etc if the files are bigger in size.

Both code and file explorer cannot delete the file. We are using the very latest Aspose.PDF for .NET downloaded yesterday, along with a trial license.
The merge works and the PDF is correct. We are using two PDF documents each with 1 page. We can delete those fine, but not the resulting merged PDF.

This has been resolved, it is not an issue with Aspose

@deisenberg

Thank you for your kind feedback.

We are glad to know that your issue has been resolved. Please feel free to contact us if you need any further assistance.