Hi,
when calling PdfExtractor.Bind with string parameter containing filename, PdfExtractor opens a filestream, and this stream is still open after the extraction is done. So afterward this file is inaccessible until the PdfExtractor instance is garbagecollected.
You should probably derive PdfExtractor from IDisposible and provide a Close method.
Cheers
Robert
Thanks for considering Aspose.
We can not reproduce such an error, could u post those codes which can do that?
Thanks for your cooperations
Best Regards.
i run Aspose.Pdf.Kit 2.0.0.0 on an W3K Server and .NET 2.0. I use FileMon from Sysinternals to monitor the file. What i see is an OPEN, READ, READ EOF, but there is no CLOSE.
try this:
string path = @“C:\Temp\Test.pdf”;
string text;
PdfExtractor extractor = new PdfExtractor();
extractor.BindPdf(path);
extractor.ExtractText();
using (MemoryStream ms = new MemoryStream())
{
extractor.GetText(ms);
text = Encoding.UTF8.GetString(ms.GetBuffer());
ms.Close();
}
File.Delete(path);
You get an exception on the last line. Something like this:
System.IO.IOException: The process cannot access the file ‘C:\Temp\Test.pdf’ because it is being used by another process.
Robik
Thanks for considering Aspose.
I have recurred this error from the posted codes above and will fix this issue ASAP.
Thanks for your coooperations.
Best Regards.
I am experiencing the same problem. Has this issue been resolved?
Thanks
Hi Aaron,
Are you using the latest version of Aspose.Pdf.Kit? I would like to share that [Aspose.Pdf.Kit for .NET 3.5.0.0](http://www.aspose.com/community/files/51/file-format-components/aspose.pdf.kit-for-.net-and-java/default.aspx)
is the latest version. Please download it and test your application with this version. If it doesn’t resolve your problem then please share the PDF files you’re having problem with. Also, share the code snippet you’re using at your end. It will also be helpful if you share the OS and the machine specifications with us.
We’re sorry for the inconvenience.
Regards,
Hi Shahzad,
I was using 3.3.0.0. I downloaded the latest and found a new Close() method. This fixes my problem.
Thanks