Forum Bugs

Table cell height issue

zebedee
Hi,
I'm working with directly converting the HTML/CSS from a Word document into a PDF. (i.e. no manual clean up in between, although I can run a regex on the code) so as you can imagine, I'm dealing with nasty inflated code.

The following is a very stripped down version of the code which is producing the issue I'm having:

<table style="width:200pt">
<tr>
	<td style="height:2pt;border: 1.5pt solid;padding: 1pt;">row 1</td>
	<td style="border: 1.5pt solid;padding: 1pt;">row 1</td>
</tr>
<tr>
	<td style="height:2pt;border: 1.5pt solid;padding: 1pt;">row 2</td>
	<td style="height:2pt;border: 1.5pt solid;padding: 1pt;">row 2</td>
</tr>
<tr>
	<td style="height:2pt;border: 1.5pt solid;padding: 1pt;">row 3</td>
	<td style="height:2pt;border: 1.5pt solid;padding: 1pt;">row 3</td>
</tr>
</table>




The problem is that when ALL the cells in the row have a height, less than that of the text inside the cell, the cell is drawn quite literally by Prince as, in this case, 2pt, in height. And therefore, row 2 and 3 are on top of each other. While in row 1, this renders in the PDF with the border expanded around the text, and not as the literal 2pt, as the second cell in the row has no height specified. Row 1 is how I would expect all the rows to act, just as how a browser renders the HTML.

So it's kind of a Prince bug, although it is caused by bad CSS code.

Is this something you would consider fixing? Or is this desired functionality, even if it is different from how a browser would render it?

I can always strip out the heights with a regular expression, but this may strip out some styling that is ok...

Suggestions?

Thanks.
mikeday
Hi zebedee,

It does appear that height should be treated as min-height when it is applied to table cells, so we will change the behaviour in the next release of Prince.

A quick workaround in the meantime would be to replace "height" with "min-height", so that it only specifies the minimum height of each table cell.

Thank you for reporting the issue! :D

Michael
zebedee
Thanks! I look forward to the next release...
mikeday
We have fixed this issue in Prince 5.1 rev 5, released today. :)