HI
I have an invoice web form in which the invoice preview created as div which includes images for header also. Can we export this div portion to pdf or word pad inorder email .Or if anyother suggessions please reply
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Manoj BhoirPosted Jun 14, 2015, 3:19 AM
Make div run at server:
Then do it like this:
using System.IO;
using System.Text;
using System.Net.Mail;
private string DivToHtml(HtmlGenericControl hgc)
protected void SendMailButton_Click(object sender, EventArgs e){
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter hw = new HtmlTextWriter(sw);
hgc.RenderControl(hw);
return sb.ToString();
}
{
MailMessage mail = new MailMessage();
mail.Body = DivToHtml(Div4); // Or here you can use Div4.InnerHTML
mail.IsBodyHtml = true;
//......
}