.msg to .pdf - unable to get rid of inline images as separate files

Hi,

I am converting MSG into PDF, all works well, but I would not like to have separate files for the inline images of the body of the mail, I cannot figure out what option I should use.

Using GroupDocs.Conversion.NETFramework v25.11

@CyrusDaVirus

Thanks for sharing the sample. Based on your description, here is a likely technical approach for Aspose.Conversion when converting msg to pdf.

When converting a .msg file to PDF with GroupDocs.Conversion, the handling of inline images is controlled by the PDF‑specific conversion options.
If you pass a PdfConvertOptions (or the equivalent options class for the .NET Framework) you can tell the converter to embed the inline images directly into the PDF instead of extracting them as separate files, e.g.:

var converter = new Converter("message.msg");
var pdfOptions = new PdfConvertOptions
{
    // set this (or a similarly named flag) to embed inline images
    EmbedImages = true          // <-- check the exact property name in your version
};

converter.Convert("output.pdf", pdfOptions);

Make sure you are using the options object when calling Convert; otherwise the default behavior extracts the images.

Clarifying questions

  1. Which overload of Convert are you currently using, and are you passing a PdfConvertOptions (or similar) instance to it?
  2. In the PdfConvertOptions class you see, is there a property that mentions embedding or extracting images (e.g., EmbedImages, ExtractImages, SaveEmbeddedImages)? If not, could you share the list of properties you have available?

The inline images are correctly embedded within the mail transformed into PDF, but aside, they all become separate PDFs, that I do not want.

Hello @CyrusDaVirus ,

Thank you for contacting us.
To prevent embedded images from being created as separate PDF files, please try setting the Depth = 0 property in EmailLoadOptions, as shown in the example below.

            Func<LoadContext, LoadOptions> emailOptions = loadContext => new EmailLoadOptions()
            {
                Depth = 0,
            };              
            
            // Load the source MSG file
            using (var converter = new GroupDocs.Conversion.Converter("sample.msg",emailOptions))
            {
                var options = new PdfConvertOptions();              
                converter.Convert("outputMsg.pdf", options);
            }

If you have any further questions, feel free to contact us again.