Free Support Forum - groupdocs.com

Converting .MSG file with embedded image, image doesn't show in PDF

Is there a switch to include the embedded images in email PDF? Already using “ConvertOwned = true” to convert attachments.

var fileStream = new MemoryStream(file);
            var loadOptions = new EmailLoadOptions { ConvertOwned = true, Format = extension switch { "eml" => EmailFileType.Eml, "msg" => EmailFileType.Msg, _ => null } };

            using (Converter converter = new[] { "eml", "msg" }.Contains(extension) ? new Converter(() => fileStream, () => loadOptions) : new Converter(() => fileStream))
            {
                var pdfstreams = new List<MemoryStream>();
                var pageStream = new GroupDocs.Conversion.Contracts.SaveDocumentStream(() => { pdfstreams.Add(new MemoryStream()); return pdfstreams.Last(); });

                converter.Convert(pageStream, new PdfConvertOptions { });

                if (pdfstreams.Count() == 1)
                    return pdfstreams.First().ToArray();
                else
                {
                    using (Merger merger = new Merger(new MemoryStream(pdfstreams.First().ToArray()), new PdfLoadOptions()))
                    {
                        for (var i = 1; i < pdfstreams.Count; i++)
                            merger.Join(new MemoryStream(pdfstreams[i].ToArray()));

                        var memoryStream = new MemoryStream();
                        merger.Save(memoryStream);
                        return memoryStream.ToArray();
                    }
                }
            }

@johntgold

Can you please share such a MSG file and we’ll investigate this scenario?

@johntgold

Please have a look at this screenshot.PNG (91.0 KB). Is this the image you are expecting in the output PDF?

correct ,
what setting am I missing?

@johntgold

You just have to apply API License like you did here.

@johntgold

Could you please share a simple console application using that issue could be preproduced at our end.?Also mention the API versions (Merger and Conversion) that you are using.

var fileStream = System.IO.File.OpenRead("FW Team Bravo Upcoming Features.msg");


            var loadOptions = new EmailLoadOptions { ConvertOwned = true, Format = extension switch { "eml" => EmailFileType.Eml, "msg" => EmailFileType.Msg, _ => null } };

            using (Converter converter = new[] { "eml", "msg" }.Contains(extension) ? new Converter(() => fileStream, () => loadOptions) : new Converter(() => fileStream))
            {
                var pdfstreams = new List<MemoryStream>();
                var pageStream = new GroupDocs.Conversion.Contracts.SaveDocumentStream(() => { pdfstreams.Add(new MemoryStream()); return pdfstreams.Last(); });

                converter.Convert(pageStream, new PdfConvertOptions { });

                if (pdfstreams.Count() == 1)
                    System.IO.File.WriteAllBytes("FW Team Bravo Upcoming Features.pdf", pdfstreams.First().ToArray());
                else
                {
                    using (Merger merger = new Merger(new MemoryStream(pdfstreams.First().ToArray()), new PdfLoadOptions()))
                    {
                        for (var i = 1; i < pdfstreams.Count; i++)
                            merger.Join(new MemoryStream(pdfstreams[i].ToArray()));

                        var memoryStream = new MemoryStream();
                        merger.Save(memoryStream);
                        System.IO.File.WriteAllBytes("FW Team Bravo Upcoming Features.pdf", memoryStream.ToArray());
                    }
                }
            }

@johntgold

We’re investigating it. Your investigation ticket ID is CONVERSIONNET-4374, you’ll be notified about the outcomes.

even a way to include inline attachments with the other attachments when making the PDF is preferable. just don’t want to have information lost.

1 Like

@johntgold

We are still investigating this scenario. You’ll be notified as there’s any progress update.

How do I look up the status of tickets? We are planning on going live in the new year and want to purchase a package that just does it instead of rolling our own.

@johntgold

We’re still working on this issue. You’ll be notified about the outcomes ASAP.

@johntgold

Your reported issue CONVERSIONNET-4374 is now fixed in API version 20.12. However, we are still investigating this issue for .NET Core with ID CONVERSIONNET-4324. Let us know if this issue persists with .NET DLL.

That works well, Thanks!

1 Like

@johntgold,

You’re welcome.

The issues you have found earlier (filed as CONVERSIONNET-4324) have been fixed in this update. This message was posted using Bugs notification tool by yevgen-nykytenko