title: Export Doc to PDF Asp.net
body: <p>So I am using this code, to export a formview to Word.
  Its works great..But I want it to export to PDF so that it cannot be edited. Or may be to a word doc so that not body can make changes.</p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
  {
      Response.Clear();
      Response.Buffer = true;
      Response.AddHeader("content-disposition",
      "attachment;filename=Report.doc");
      Response.Charset = "";
      Response.ContentType = "application/vnd.ms-word";
      StringWriter sw = new StringWriter();
      HtmlTextWriter hw = new HtmlTextWriter(sw);
      FormView1.DataBind();
      FormView1.RenderControl(hw);
      Response.Output.Write(sw.ToString());
      Response.Flush();
      Response.End();
  }
  </code></pre>
  
  <p>The problem is, even when I change the content type and header element in the above code, it says that the output pdf has errors. </p>
  
  <p>I really want to either convert the doc to pdf or generate pdf using this code.</p>
  
  <p>Please help.</p>
  
  <p>Thanks..</p>