close a file

close a file

Forum member · Aug 4, 2010
I am writing a file through objDocument.draw(xxx.pdf) At that time i am unable to open a file through my application. I am getting the error "file is already opened by other process". The problem is when you are writing it you are not closing it. I will be waiting for reply

Re: close a file

Support · Aug 4, 2010
Hello, After writing the PDF to disk using the draw method we do close all the resources we are using. We are also able to open the PDF file using the below code without any problem. document.draw("MyDocument.pdf"); try { Runtime.getRuntime().exec("cmd.exe /c start MyDocument.pdf"); }catch (Exception e) { //Exception code } Can you please send over a sample code to our [^a|mailto:support@cete.com|Support Team^] if you are still having a problem so that we can look into it further? Thanks, ceTe Software Support Team.

Re: close a file

Forum member · Jan 24, 2011
Hi, I've run into a similar issue where I am creating PDFs for unit tests and then attempting to delete them when the test is complete. The File.delete() method fails to delete the PDF file because it is still in use. The test PDFs I'm creating are saved using the document.Draw() method. Interestingly, if I call System.gc() at the end of my function File.delete() starts working again. Is this a bug in the DynamicPDF library (v5.0.1 build 12733)? Thanks, Chris McKinnon

Re: close a file

Support · Jan 24, 2011
Hello Chris, Yes, we do have an open bug similar to the issue described in this post and our developers are looking into it. We will post on here once a fix is available. Thanks, ceTe Software Support Team.

Re: close a file

Forum member · May 27, 2021
I have the same problem in .NET. Do you have a fix for that?

Re: close a file

Support · May 28, 2021
Hello, We're not aware of an issue like this in the .NET product. Please send over the following information to [^a|mailto:support@dynamicpdf.com|opennewwindow|support@dynamicpdf.com^] so we can look into it further. 1. Code sample or a simple console application which uses static data to recreate the error. 2. Source PDFs (if you're using one). 3. Exact version and build number of DynamicPDF Core Suite for .NET used in your application. You can get this information by right clicking on the DLL file>>Properties>>Details tab>>Product version. Take a screenshot of Details tab and send it over to us. 4. Full error message along with stack trace. 5. Steps need to recreate the error. Thanks, ceTe Software Support Team