简体   繁体   中英

Attaching PDF without saving document using SyncFusion C#.net

Can someone help me or give me a link on how to attach a PDF to email using syncfusion html to pdf converter without saving the document?

here is my code:

//Convert URL to PDF
PdfDocument doc = htmlConverter.Convert(render_to_html(Panel_preview_attachment), baseUrl);

doc.Save(path + "Attachments\\" + file_name); //I need to remove this

string empPdf = path + "Attachments\\" + file_name;

LinkedResource linkedresource = new LinkedResource(empPdf, "application/pdf");
linkedresource.ContentId = "empPdf";
linkedresource.ContentType.Name = file_name;
htmlView.LinkedResources.Add(linkedresource);

We can convert HTML to PDF and send the PDF document in a mail without saving it to a filesystem. We can save the PDF document to the memory stream and we can send it to a mail. Please refer below link for more information,

HTML to PDF : https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/webkit

Email output PDF : https://www.syncfusion.com/kb/6064/how-to-create-pdf-dynamically-and-email-as-attachment

Note : I work for Syncfusion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM