Saving emails to pdf

If the email I am converting to pdf contains attachments, what is the best way to include these attachments in the converted pdf? Can you have the attachments appended to the end of the pdf or add them with a heading onto separate pages?

I know I have to work with the attachment.Data memory stream, but is there a way to insert the memory steam data into the document? Or do I need to save these attachments as temp files and work with them someway once they are saved temporarily?

Hi David,

You don’t have to save them into a temporary file, you can use the memory streams.
But I’m not sure what option would be best for you.

For instance, please check the second example on the following page:
https://www.gemboxsoftware.com/email/examples/c-sharp-convert-email-to-pdf/107
It shows how to add attached images.

You could also add attached Word, Excel, PowerPoint, etc. files by converting them to PDF files with GemBox.Document, GemBox.Spreadsheet, and GemBox.Presentation, and then append those PDF files using GemBox.Pdf. Let me know if you’re interested in this approach and I’ll create a sample code for you.

Last, instead of displaying those attachments with PDF pages, you could add those email attachments as PDF attachments using GemBox.Pdf:
https://www.gemboxsoftware.com/pdf/examples/c-sharp-pdf-embedded-files/701

Regards,
Mario