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:
![](https://kryten.navarik.com/~jfowlie/pdf-issue.gif)
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.
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>
![](https://kryten.navarik.com/~jfowlie/pdf-issue.gif)
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.