title: How to create an invoice in asp.net
body: <p>The only thing i need is to add the company name on the top and also today's date but everything else is working for me now.  The user is able to select specific rows and export the selected rows in pdf but i need the company name on the top please help.  thanks</p>
  
  <pre><code> protected void ExportToPDF(object sender, EventArgs e)
      {
  
  
        using (StringWriter sw = new StringWriter())
        {
          using (HtmlTextWriter hw = new HtmlTextWriter(sw))
          {
  
            //Hide the Column containing CheckBox
            GridView1.Columns[0].Visible = false;
            foreach (GridViewRow row in GridView1.Rows)
            {
              if (row.RowType == DataControlRowType.DataRow)
              {
                //Hide the Row if CheckBox is not checked
                row.Visible = (row.FindControl("chkSelect") as CheckBox).Checked;
                // pnlBtn.Visible = true;
              }
            }
  
            GridView1.RenderControl(hw);
            StringReader sr = new StringReader(sw.ToString());
            Document pdfDoc = new Document(PageSize.A2, 10f, 10f, 10f, 0f);
            HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
            PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
            pdfDoc.Open();
            htmlparser.Parse(sr);
            pdfDoc.Close();
  
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.pdf");
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Write(pdfDoc);
            Response.End();
          }
        }
  
      }
  </code></pre>