title: How to convert panel into pdf with same font and style using iTextSharp
body: <p>I am using iTextSharp dll to convert panel in aspx page. Panel have controls like label, textboxes along with gridview and listview in it. The problem is this that after converting panel to pdf format i lost all the formatting of listview/gridview/other controls. I am using below code`</p>
  
  <pre><code>    string file = txtenqid.Text + ".pdf";
      string attachment = string.Format("attachment;filename={0}", file);
      Response.ClearContent();
      Response.AddHeader("content-disposition", attachment);
      Response.ContentType = "application/pdf";
      StringWriter sw = new StringWriter();
      HtmlTextWriter hw = new HtmlTextWriter(sw);
      Panel1.RenderControl(hw);
      StringReader sr = new StringReader(sw.ToString());
     iTextSharp.text.Document pdfdoc = new iTextSharp.text.Document();
     pdfdoc.SetMargins(0f, 0f, 0f, 0f);
  
      pdfdoc.SetPageSize(iTextSharp.text.PageSize.A3);
      HTMLWorker htmlparser = new HTMLWorker(pdfdoc);
      PdfWriter.GetInstance(pdfdoc, Response.OutputStream);
      pdfdoc.Open();
      htmlparser.Parse(sr);
      pdfdoc.Close();
  </code></pre>
  
  <p>please do  the needful changes in the code so that i got my desired result. Thanks in advance</p>