We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to create PDF document in memory and email?

I would like to know if it is possible to create a PDF document in memory and then email it? I'm using the following code which creates an attachment but the document is corrupt?

            MemoryStream stream = new MemoryStream();
            document.Save(stream);
            stream.Position = 0;
            document.Close(true);
            Attachment file = new Attachment(stream, strFileName, "application/pdf" ); 

Thanks

2 Replies

DD Dharmesh Desai February 7, 2014 06:19 PM UTC

I solved this issue by adding stream.Seek(0,SeekOrigin.Begin).


SM Suresh M Syncfusion Team May 19, 2014 08:52 AM UTC

Hi Dharmesh,

Thank you for using Syncfusion products.

We are glad to hear that your issue is resolved, please let us know if you need any further assistance.

Thanks,
Suresh

Loader.
Up arrow icon