Free Support Forum -

Convert .eml with Spreadsheet attachment to PDF using C#

This feature covers exactly what I was looking for!
It’s working very well in our test scenarios with multiple different attachment types but I haven’t found a way to configure the conversion for type specific settings, e.g. spreadsheet attachment should not be converted as single page PDFs which is the default for that type of conversion.

Is it possible to configure the attachment conversion depending on the attachment file type in your example - index 1 would be the email itself, index 2 is a jpg file and index 3 would be an xlsx file?

var source = “sample-with-attachment.eml”;
var loadOptions = new EmailLoadOptions {ConvertAttachments = true};
using (var converter = new Converter(source, () => loadOptions))
var index = 1;
var options = new PdfConvertOptions();
// Note: index = 1 is the email itself, all following indexes are attachments
converter.Convert(() => new FileStream($“converted-{index++}.pdf”, FileMode.Create) , options);

Thank you.

This Topic is created by atirtahir3 using Email to Topic tool.

1 Like


We are inestigating this scenario. Your investigation ticket ID is CONVERSIONNET-3682. As there’s any further update, you’ll be notified.