hii all,
i am export a web page in pdf format.. my code is working properly .. but my problem is that i m creating a table with column width and height.. when i run this page then table is showed properly with assigned width and height..
when i print as pdf as button click .. the all cloumn width is not working properly.. all the columns has same width..
there is no error in my code.. problem in my table format after print as pdf
where is problem. i m not able to find out..
my some code is:
<table align="center" bgcolor="#669999" cellpadding="0"
cellspacing="0" style="border: thin solid #333300;
width: 900px; height: 174px; text-align: center;" border="2">
<tr>
<td class="style3">
<strong style="font-size: small">SI.No</strong></td>
<td class="style4">
<strong style="font-size: small">HH No</strong></td>
<td class="style4">
<strong style="font-size: small">Name of Children</strong></td>
<td class="style3">
<strong style="font-size: small">Male(M)<br />/Female(F)</strong></td>
<td class="style4">
<strong style="font-size: small">Date of Birth</strong></td>
<td class="style3">
<strong style="font-size: small">Disability(if any)</strong></td>
<td class="style4">
<strong style="font-size: small">Name of Father</strong></td>
<td class="style4">
<strong style="font-size: small">Name of Mother</strong></td>
<td class="style3">
<strong style="font-size: small">Caste</strong></td>
</tr>
</table>
my button click code is for export in pdf is:
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);
this.Page.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 5f, 5f, 0f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();