I am trying to convert Html to PDF. I am using iTextSharp. I found that iTextSharp does not support CSS well. Infact I think HtmlWorker thread does not support it all. To compound my problem iTextSharp does not seem to support RowSpan either.
This is what I am trying to generate: http://jsbin.com/jovugohuju/1/edit?html,output
<table border="1" width="700">
<tr>
<td colspan="5" align="center" bgcolor="lightblue">INVOICE</td>
</tr>
<tr>
<td colspan="2" rowspan="4" bgcolor="white"><b>AIRNET NETWORKS</b>
<br>asdadadadaada asd asd a ads adsadsadsadasd</td>
<td>INVOICE</td>
<td>DATE</td>
<td>aDATEsd</td>
</tr>
<tr>
<td>Order</td>
<td>XXXX</td>
<td>Ref XXXXXX</td>
</tr>
<tr>
<td>Delivery</td>
<td>XXXX</td>
<td>Ref XXXXXX</td>
</tr>
<tr>
<td>Due Date</td>
<td>XXXX</td>
<td>Ref XXXXXX</td>
</tr>
<tr>
<td colspan="2" rowspan="4" bgcolor="white">
<p><b>CUSTOMER NAME</b>
</p>asd asd adadaadadadada adadaadsasdad ada asd adad</td>
</tr>
<tr>
<td>Customer Care No:</td>
<td colspan="2">544646454,88877978975</td>
</tr>
<tr>
<td>Email Id</td>
<td colspan="2">airnet@gmail.com</td>
</tr>
<tr>
<td>Account Details</td>
<td colspan="2">5522245125545455 IFSC 323hasd</br>SBI India</td>
</tr>
</table>
<table border="1" width="700">
<tr>
<td bgcolor="lightblue" height="15">Srno</td>
<td bgcolor="lightblue">Particulars</td>
<td bgcolor="lightblue">Quantity</td>
<td bgcolor="lightblue">Rate/Month</td>
<td bgcolor="lightblue">Total Rupees</td>
<tr>
<td valign="top">1</td>
<td valign="top">1 MBPS Plan</td>
<td valign="top">1</td>
<td valign="top">600</td>
<td valign="top">692</td>
</tr>
</tr>
<tr>
<td height="300" valign="top">1</td>
<td valign="top">1 MBPS Plan</td>
<td valign="top">1</td>
<td valign="top">600</td>
<td valign="top">692</td>
</tr>
<tr>
<td colspan="3" rowspan="3" valign="top">asdasdasd</td>
<td colspan="1">Total</td>
<td colspan="1">692</td>
</tr>
<tr>
<td>Service Tax</td>
<td>692</td>
</tr>
<tr>
<td>Grand Total</td>
<td>692</td>
</tr>
</table>
C# CODE:
Document document = new Document();
document.SetPageSize(iTextSharp.text.PageSize.A4);
iTextSharp.text.pdf.draw.LineSeparator line1 = new iTextSharp.text.pdf.draw.LineSeparator(0f, 100f, iTextSharp.text.Color.BLACK, Element.ALIGN_LEFT, 1);
string NEWhtmlText="<table border='1' width='500' > <tr> <td bgcolor='lightblue' height='15' >Srno</td><td bgcolor='lightblue'>Particulars</td><td bgcolor='lightblue' >Quantity</td><td bgcolor='lightblue'>Rate/Month</td><td bgcolor='lightblue'>Total Rupees</td> </tr> <tr> <td valign='top' >1</td><td valign='top' >1 MBPS Plan</td><td valign='top'>1</td><td valign='top'>600</td><td valign='top'>692</td> </tr> <tr> <td height='300' valign='top' >1</td><td valign='top' >1 MBPS Plan</td><td valign='top'>1</td><td valign='top'>600</td><td valign='top'>692</td> </tr> <tr><td colspan='3' rowspan='3' valign='top'>asdasdasd</td><td colspan='1'>Total</td><td colspan='1'>692</td></tr> <tr><td>Service Tax</td><td>692</td></tr> <tr><td>Grand Total</td><td>692</td></tr> </table>";
PdfWriter.GetInstance(document, new FileStream(saveFileDialog1.FileName, FileMode.Create));
document.Open();
iTextSharp.text.html.simpleparser.HTMLWorker hw = new iTextSharp.text.html.simpleparser.HTMLWorker(document);
hw.Parse(new StringReader(NEWhtmlText));
document.Close();
OUTPUT(unwanted):