close a file

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for Java (v5)  /  close a file

DynamicPDF Generator for Java (v5) Forum

 Aug 04 2010 6:06 AM
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
 Aug 04 2010 8:44 AM
Posted by a ceTe Software moderator
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 Support Team if you are still having a problem so that we can look into it further?

Thanks,
ceTe Software Support Team.
 Jan 24 2011 2:49 PM
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
 Jan 24 2011 4:15 PM
Posted by a ceTe Software moderator
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.
 Feb 08 2011 3:48 PM
Posted by a ceTe Software moderator
Hello,

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.
 May 27 2021 5:19 PM
I have the same problem in .NET.  Do you have a fix for that?
 May 28 2021 10:55 AM
Posted by a ceTe Software moderator
Hello,

We're not aware of an issue like this in the .NET product. Please send over the following information to 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

All times are US Eastern Standard time. The time now is 12:31 PM.