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