Quantcast
Channel: Aspose.Email Product Family
Viewing all articles
Browse latest Browse all 1367

How to convert an MSG to PDF without attachments

$
0
0
Hi  ,
I am using aspose.email and aspose.word libraries to convert an MSG file to PDF. But when i convert it using the following code, attachments are also getting inserted(which i don't need) to the output  PDF file. I am looking for just the data in the MSG file, it needs to skip the attachments

//Code snippet

 MailMessage mailMsg = MailMessage.Load(InputFileName);               
                              
  MemoryStream ms = new MemoryStream();

  //Save as MHTML
   mailMsg.Save(ms, MailMessageSaveType.MHtmlFormat);

  //create an instance of LoadOptions and set the LoadFormat to Mhtml
   var loadOptions = new Aspose.Words.LoadOptions();
   loadOptions.LoadFormat = Aspose.Words.LoadFormat.Mhtml;

   //create an instance of Document and load the MTHML from MemoryStream
   var document = new Aspose.Words.Document(ms, loadOptions);

   //create an instance of HtmlSaveOptions and set the SaveFormat to Html
      var saveOptions = new Aspose.Words.Saving.PdfSaveOptions();

     //save the document to Html file
       document.Save(OutputFileName, saveOptions);

   Right now i am using Aspose.Email version  3.8.0.0 and Aspose.Word version 13.8.0.0; As we are not in a position to upgrade the  Aspsose libraries i am looking for a solutions in these versions. 
Appreciate your support

Thanks,
Subhash     

Viewing all articles
Browse latest Browse all 1367

Trending Articles