Hi,
I am trying to generated a pdf document from a word document using below code. the pdf file is getting genenarted correctrly the location specified by me. but once the file is generated, I need to make use of the file, for example, open it for viewing purpose or copy it to some local folders through code. While i try to open the pdf file, the error comes saying “the file is in use by other process”. if I go to task manager and kill the aspnet process, the file is getting opened but not before that. Ideally, if the file is created, the resourses used by the viewer dll should be released. I tried clearing the objects in finally block but nothing is helping. pls check the sample code below that I am using
ViewerImageHandler imageHandler;
FileContainer container;
try
{
Utilities.ApplyLicense();
string DocumentName = “DOCXsample.docx”;
imageHandler = new ViewerImageHandler(Utilities.GetConfigurations());
container = imageHandler.GetPdfFile(DocumentName);
String filename = “DOCXsample.pdf”;
Utilities.SaveFile(filename, container.Stream);
}
catch (Exception ex)
{
}
finally
{
imageHandler = null;
container = null;
}