Regarding the instance of the PDF is not getting released from memory

Hi am using Aspose Pdf to generate PDF documents in my application. My application is developed using .Net2008 and WPF. The document generation using Aspose doesn't have any problem. After generating the document i have to send the document as attachment in a mail.

While sending mail am getting an exception "The process is already used by another process". The Acrobat .exe is running in the task manager. But am closing the file in my application. Let me know wat is the solution for this..

Attached is my code snippet

public void GeneratePDFDocument(object sourceObject, string xslPath, string pdfName, string path)

{

try

{

StringBuilder sbXMLContent = new StringBuilder();

using (XmlWriter writer = XmlWriter.Create(sbXMLContent))

{

XmlSerializer serializer = new XmlSerializer(sourceObject.GetType());

serializer.Serialize(writer, sourceObject);

}

XmlDocument xmlDocument = new XmlDocument();

xmlDocument.LoadXml(sbXMLContent.ToString());

objPdf.BindXML(xmlDocument, xslPath);

if (Directory.Exists(path))

{

objPdf.Save(path + pdfName);

}

else

{

Directory.CreateDirectory(path);

objPdf.Save(path + pdfName);

}

}

catch (Exception)

{ }

}

After generating the document am sending the generated document as attachment in a mail. But the object objPdf is not cleared from the memory. So getting an error stating "The process is used by another proces." Do help me in this to get a solution

Hi,

Thanks for considering Aspose.

Please close the Xml writerStream while calling writer.Close(); after serializer.Serialize(writer, sourceObject); and once the Pdf file is saved, please call objPdf.Close(); to close the pdf file. In case the issue still persists, feel free to share.

Hi i tried what u have mentioned… i.e Closing of the writer object. But still the same problem persists… Can u help me out in fixing this?

Hi,

Sorry for replying you late.

We are looking into the details of this issue and will reply to you soon. It would be more convenient for us, if you could share the project, so that we can test the issue.