PDF conversion of MSG file containing embedded image results in blank document

Hi,


When converting the attached MSG file to PDF I get an empty document.

The MSG file contains an embedded image. I am aware embedded images are not supported when converting MSG files to PDF, but I would expect that the text is displayed in the result PDF document.

Is this a bug or am I missing something here?

This is the piece of code I am using for the conversion:

MapiMessage mapiMessage = MapiMessage.FromStream(fileStream);

using (var tempStream = new MemoryStream())
{

TextWriter textWriter = new StreamWriter(tempStream);
textWriter.Write(message.BodyRtf);
textWriter.Flush();

var doc = new Aspose.Words.Document(tempStream);

doc.Save(…, SaveOptions.CreateSaveOptions(SaveForm.Pdf));

textWriter.Close();
}

Hi,


Thank you for inquiry.

Could you please try to use MailMessage class for doing MSG → MHTML → PDF conversion? The technique would be very similar to the one mentioned at http://www.aspose.com/documentation/.net-components/aspose.network-for-.net/convert-outlook-message-file-msg-to-tiff-image.html page. But, in the end you need to save in PDF format using Aspose.Words.

Hi,


Yeah, this works. I have attached the PDF I got.

The result PDF contains a header (To, From, Subject, etc) and the embedded image is replaced by an “X”. Is it possible to have these not included in the PDF (via some options somewhere)?

I understand that embedded images are also not supported using this conversion method (MSG->MHTML->PDF), correct?

Hi,


Embedded images from HTML formatted MSG files are supported in MSG to MHTML conversion. I have also checked with some other files and I can see the embedded images in the MHTML and PDF. One of these is attached. I will forward your MSG to the development team for their analysis and will update you here later.

If you want to omit the images, then you can use another approach. MSG --> HTML --> PDF. In HTML, you can edit it to remove all the tags.

Following programs are attached:
  1. MsgToPdfA - contains my sample MSG with embedded images which are transferred to PDF
  2. MsgToPdfUsingHtml - edit the HTML, remove tags and then transform to PDF