Can i force delete a file Created by Aspose as it's still used by Aspose?

I am trying to save a PDF file as a docx file inside Java using this code:

Document pdfDoc = new Document( pdfPath );
pdfDoc.save( docXPath, SaveFormat.DocX );

But sometimes the process might freeze so i force cancel it using Timeout. Then i try deleting the created docx file but this fails as the file is still opened by the Aspose resources. I am trying this code but it does nothing and the file is still out there:

Document.endOperation();
File corruptedDocxFile = new File( docXPath );
if( corruptedDocxFile.exists() ) corruptedDocxFile.delete();

Is there a way to force release Aspose resources so i could delete this corrupted file?

@robertsmichael

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFJAVA-43349

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

I am new here!
Where can i follow the status of bug PDFJAVA-43349?

@robertsmichael

The ticket status can be viewed at the bottom of this thread. Furthermore, you will receive a notification in this forum thread as soon as your issue is resolved and a fix is available. Meanwhile, you can have follow ups on the ticket progress by posting a message here and we will provide you progress updates.

1 Like

@robertsmichael

We tried to reproduce the resource blocking after killing the process but did not reproduce it, the output file is deleted without any problems.

Please, share more details, such as the input file, OS, and details about how to force cancel the process.

Also, you can try to close the Document before killing the process:

Document pdfDoc = new Document(pdfPath);
pdfDoc.save(docXPath, SaveFormat.DocX);
pdfDoc.close();

Or can control the output file with FileOutputStream:

Document pdfDoc = new Document(pdfPath);
FileOutputStream outputStream = new FileOutputStream(docXPath);
pdfDoc.save(outputStream, SaveFormat.DocX);
outputStream.close();