How to save data in pdf formate in asp.net?
<p>On saving I get following error.</p>

<p>I am Saving GridView data In pdf.</p>

<p>Gridview is exported to pdf. But showing one line in bottom of the pdf file i.e.</p>

<pre><code>//(function() {var fn = function() {$get("ctl00_ToolScriptmgr_HiddenField").value = '';Sys.Application.remove_init(fn);};Sys.Application.add_init(fn);})();//


enter code here #region To save Data In Pdf
    Response.ContentType = "application/pdf";
    Response.AddHeader("content-disposition", "attachment;filename=Projects.pdf");
   Response.Cache.SetCacheability(HttpCacheability.NoCache);
    StringWriter sw = new StringWriter();
   HtmlTextWriter hw = new HtmlTextWriter(sw);
    HtmlForm frm = new HtmlForm();
    gridsearch.Parent.Controls.Add(frm);
    gridsearch.Columns[0].Visible = false;
  gridsearch.Columns[1].Visible = false;
    frm.Attributes["runat"] = "server";
    frm.Controls.Add(gridsearch);
    frm.RenderControl(hw);
    StringReader sr = new StringReader(sw.ToString());
    Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
    HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
    PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
    pdfDoc.Open();
    htmlparser.Parse(sr);
    pdfDoc.Close();
    Response.Write(pdfDoc);
    Response.End();
    #endregion
</code></pre>
