I am trying to produce a HTML template to precisely match the requirements of a customer. This HTML template is then converted to a PDF using flyingsaucer.
Specifically, I need a table to be a set height on the page. The table has to have columns, but no row lines except for on the header. (Hey, don't shoot me, the customer demands it!)
The CSS:
#invoice-table {
border: 1px solid darkblue;
border-spacing: 0;
clear: both;
margin: 2mm 0mm;
height: 100mm;
width: 100%;
}
#invoice-table th, td { border-left: 1px solid darkblue; }
#invoice-table th:first-child, td:first-child { border-left: none; }
#invoice-table th { border-bottom: 1px solid darkblue; }
#invoice-table td { vertical-align: top; font-size: 8pt; }
th { text-align: center; font-weight: normal; }
.amount { text-align: right; }
.invoice_line { height: 6mm; }
.invoice_line td, .invoice_line th { padding: 1mm; }
And the table:
<table id="invoice-table">
<colgroup>
<col width="35mm" />
<col />
<col width="20mm" />
<col width="20mm" />
<col width="20mm" />
</colgroup>
<tr class="invoice_line">
<th>Rate Class</th>
<th>Rate and Driver Details</th>
<th>Item/s</th>
<th>Rate</th>
<th>Amount</th>
</tr>
<tr class="invoice_line">
<td>Drivers</td>
<td class="site">Charges for the provision of temporary resources (supply of driver/s)
week ending 12th Oct 2013 for Getty Museum</td>
<td class="amount">1</td>
<td class="amount">£341.63</td>
<td class="amount">£341.63</td>
</tr>
<tr class="invoice_line">
<td>Drivers</td>
<td class="site">Charges for the provision of temporary resources (supply of driver/s)
week ending 12th Oct 2013 for Staples Center</td>
<td class="amount">1</td>
<td class="amount">£330.00</td>
<td class="amount">£330.00</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
This works! Almost... !!!
Using flying saucer R8, this produces almost the exact required effect. However, there is a gap at the bottom of the table (see screenshot below). I am trying to get rid of that gap.
The gap does not appear on a browser. Is this a flyingsaucer bug or am I missing something? Or is there a better way to achieve the same effect?
I managed to solve this some time ago. Looking at the CSS, the solution appears to be one of setting border-collapse or box-sizing or both.
#invoice-table {
border: 0.5pt solid darkblue;
border-collapse: collapse;
border-spacing: 0;
box-sizing: border-box;
clear: both;
margin: 2mm 0mm;
height: 100mm;
width: 100%;
}