Hey guys,
I have a situation here and I am struggling to overcome it for the last 2 days.
I have a ASP web page which takes input from the user and stores the values.
I want to convert the webpage once the user fills in the form into a PDF file with these values and I wanna attach the PDF to the mail.
I av problems converting the web page into a PDF file, can any 1 help me with some code snippet on doing this, I surfed the whole internet and nothing really actually worked or created PDF that said could not open..
I will attach the code that I av written inside a button click event, this code generates the PDF but it cannot be opened as it says wrong format..
Help me on how to attach the created PDF to the mail, where I have used the Outlook mail calling it with mailto function.
Hope some1 finds my prob a piece of cake.
I used the Itextsharp
protected void Button3_Click(object sender, EventArgs e)
{
string filename = "Customer";
Response.ClearHeaders();
Response.AddHeader("content-disposition", "attachment;filename=" + filename + ".pdf");
Response.Charset = "";
// Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/pdf";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
form1.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
Pls help thank you guys,,,