I am exporting the HTML Content to PDF.
System.IO.StringWriter sWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWriter = new HtmlTextWriter(sWriter);
Response.Buffer = true;
FormId.RenderControl(htmlWriter);
Response.ContentType = "application/pdf";
// Added appropriate headers
Response.AddHeader("Content-Disposition", "inline; filename=XXX.pdf");
Response.AddHeader("Content-Length", htmlWriter.ToString().Length.ToString());
Response.Output.Write(sWriter.ToString());
Response.Flush();
Response.Close();
FormId is my Div past of the content..
I am getting the error as "File does not begin with '%PDF-'"
I have included Response.clear(); The output is not coming