Update: ITextSharp 5.5.2 Supports this feature but previous version of ITextSharp do not.
Does ITextSharp 5.5.1 support Class Element CSS selectors? Such as
<style>
.test td {
border: 1px solid green;
}
</style>
I'm getting a result like this
When it should be something like
If not how would I go about achieving the same results?
Using the following code I do not get the desired results.
byte[] bytes;
Document document = new Document();
using (var memoryStream = new MemoryStream())
using (var pdfWriter = PdfWriter.GetInstance(document, memoryStream))
{
document.Open();
XMLWorkerHelper.GetInstance().ParseXHtml(pdfWriter, document, new StringReader(html));
document.Close();
bytes = memoryStream.ToArray();
}
return bytes;
Here is my full html for reference
<html>
<head>
<style>
.test td {
border: 1px solid green;
}
</style>
</head>
<body>
<table class='test'>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Savings</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
<td>$100</td>
</tr>
<tr>
<td>Lois</td>
<td>Griffin</td>
<td>$150</td>
</tr>
<tr>
<td>Joe</td>
<td>Swanson</td>
<td>$300</td>
</tr>
<tr>
<td>Cleveland</td>
<td>Brown</td>
<td>$250</td>
</tr>
</table>
</body>
</html>