title: asp.net page convert to pdf with css class design
body: <p>How to convert <strong>.aspx</strong> page with css class design to pdf format which contains <strong>asp.net</strong> controls.</p>
  
  <p>I have used some code but its not covert the page with proper allignment and design.</p>
  
  <pre><code>    Response.ContentType = "application/pdf";
      Response.AddHeader("content-disposition", "attachment;filename=UserDetails.pdf");
      Response.Cache.SetCacheability(HttpCacheability.NoCache);
      StringWriter sw = new StringWriter();
      HtmlTextWriter hw = new HtmlTextWriter(sw);
      a.RenderControl(hw);
      StringReader sr = new StringReader(sw.ToString());
      Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0.0f);
      HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
      PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
      pdfDoc.Open();
      htmlparser.Parse(sr);
      pdfDoc.Close();
      Response.Write(pdfDoc);
      Response.End();
  </code></pre>
  
  <p>I have used this code..</p>
  
  <p>Can you help me.please.</p>