I have the following HTML:
<html>
<head>
<style>
.styled-table {
border-collapse: collapse;
margin: 25px 0;
font-size: 0.9em;
font-family: sans-serif;
min-width: 400px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
width: 100%;
}
.styled-table thead tr {
background-color: #004298;
color: #ffffff;
text-align: left;
}
.styled-table th,
.styled-table td {
padding: 12px 15px;
}
.styled-table tbody tr {
border-bottom: 1px solid #dddddd;
}
.styled-table tbody tr:nth-of-type(even) {
background-color: #f3f3f3;
}
.styled-table tbody tr:last-of-type {
border-bottom: 2px solid #004298;
}
.styled-table tbody tr.active-row {
font-weight: bold;
color: #004298;
}
</style>
</head>
<body>
<table class='styled-table'>
<thead>
<tr class='active-row'>
<th>Allowed access control list</th>
</tr>
</thead>
<tr class='active-row'>
<td>
<table class='styled-table'>
<tr>
<td>172.16.40.250 - Blue Coat SG-VA Series>show allowed-access</td>
</tr>
<tr>
<td>192.168.1.69 255.255.255.255</td>
</tr>
<tr>
<td>192.168.1.71 255.255.255.255</td>
</tr>
</table>
</td>
</tr>
</table>
<p>
<table class='styled-table'>
<thead>
<tr class='active-row'>
<th>Proxy Client and Unified Agent settings</th>
</tr>
</thead>
<tr class='active-row'>
<td>
<table class='styled-table'>
<tr>
<td colspan='2'>172.16.40.250 - Blue Coat SG-VA Series>show clients</td>
</tr>
<tr>
<td colspan='2'>Client Manager configuration</td>
</tr>
<tr>
<td><strong> Activation </strong></td>
<td> disabled</td>
</tr>
<tr>
<td><strong> Host </strong></td>
<td> from client request</td>
</tr>
<tr>
<td><strong> Install Port </strong></td>
<td> 8084</td>
</tr>
<tr>
<td><strong> Keyring </strong></td>
<td> default</td>
</tr>
<tr>
<td><strong> Manager Version </strong></td>
<td> 1</td>
</tr>
<tr>
<td><strong> PxC Software Upgrade URL </strong></td>
<td> </td>
</tr>
<tr>
<td><strong> PxC Archive Version </strong></td>
<td> 3.4.3.2</td>
</tr>
<tr>
<td><strong> PxC MSI file size </strong></td>
<td> 10951680 bytes</td>
</tr>
<tr>
<td><strong> PxC BSX file size </strong></td>
<td> 9668837 bytes</td>
</tr>
<tr>
<td><strong> UA Software Upgrade URL </strong></td>
<td> </td>
</tr>
<tr>
<td><strong> UA Archive Version </strong></td>
<td> 4.7.1.188819</td>
</tr>
<tr>
<td><strong> UA32 MSI file size </strong></td>
<td> 4939776 bytes</td>
</tr>
<tr>
<td><strong> UA64 MSI file size </strong></td>
<td> 6496256 bytes</td>
</tr>
<tr>
<td><strong> UA OSX ZIP file size </strong></td>
<td> 11663933 bytes</td>
</tr>
<tr>
<td><strong> Update Interval </strong></td>
<td> 120 minutes</td>
</tr>
<tr>
<td><strong> Uninstall Password </strong></td>
<td> Disabled</td>
</tr>
<tr>
<td colspan='2'>Client Manager Web-filter configuration</td>
</tr>
<tr>
<td><strong> Activation </strong></td>
<td> disabled</td>
</tr>
<tr>
<td><strong> Safe Search </strong></td>
<td> disabled</td>
</tr>
<tr>
<td><strong> HTTPS Filtering </strong></td>
<td> enabled</td>
</tr>
<tr>
<td><strong> Default Action </strong></td>
<td> allow</td>
</tr>
<tr>
<td><strong> Failure Mode </strong></td>
<td> closed</td>
</tr>
<tr>
<td colspan='2'> Log Settings </td>
</tr>
<tr>
<td><strong> Activation </strong></td>
<td> enabled</td>
</tr>
<tr>
<td><strong> Log </strong></td>
<td> all</td>
</tr>
<tr>
<td><strong> Early upload </strong></td>
<td> 50 megabytes</td>
</tr>
<tr>
<td><strong> Periodic upload </strong></td>
<td> 24 hrs 0 minutes</td>
</tr>
<tr>
<td colspan='2'> Primary FTP Server </td>
</tr>
<tr>
<td><strong> Host </strong></td>
<td> </td>
</tr>
<tr>
<td><strong> Port </strong></td>
<td> 21</td>
</tr>
<tr>
<td><strong> Path </strong></td>
<td> </td>
</tr>
<tr>
<td colspan='2'> Alternate FTP Server </td>
</tr>
<tr>
<td><strong> Host </strong></td>
<td> </td>
</tr>
<tr>
<td><strong> Port </strong></td>
<td> 21</td>
</tr>
<tr>
<td><strong> Path </strong></td>
<td> </td>
</tr>
<tr>
<td colspan='2'> List of Selected Categories and Actions</td>
</tr>
<tr>
<td colspan='2'>Locations</td>
</tr>
<tr>
<td><strong> Webfilter </strong></td>
<td> Enabled</td>
</tr>
<tr>
<td colspan='2'> Locations List</td>
</tr>
</table>
</td>
</tr>
</table>
<p>
</body>
</html>
I call the following method in my C# code:
public void createPdf(string html, string dest)
{
HtmlConverter.ConvertToPdf(html, new FileStream(dest, FileMode.Create));
}
The converted PDF ignores most of the CSS directives. I tried this on iText's online converter and get the same results.
The HTML looks like this:
The converted PDF looks like this:
Any ideas why this is happening and what I can do to fix? Thanks!