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
close a file
Re: close a file
Support · Aug 4, 2010Hello,
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, 2011Hi,
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, 2011Hello 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
Support · Feb 8, 2011Hello,
This issue has been fixed in Generator for Java v6.0 and a build has been released. The new build of v6.0 can be downloaded at:
http://www.DynamicPDF.com/Products/DynamicPDFforJava/Download.csp
Thanks,
ceTe Software Support Team.
Re: close a file
Forum member · May 27, 2021I have the same problem in .NET. Do you have a fix for that?
Re: close a file
Support · May 28, 2021Hello,
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