1

Dear html2pdf,

First of all, thanks for your nice work!

I was trying to convert a HTML table with rotated column headers based on exemple08.php.

Column headers:
- contain a DIV
- DIV is rotated by 270 degrees
- content of DIV is wide and low, e.g. width: 200px; heigth: 20px

html2pdf converted the table almost correctly, column headers are rotated nicely.
However after rotation the table columns still remain wide c.a. 200px instead of 20px.
Height of 20px has no effect. Only DIV heights larger than 200px have effect.

After walking through the code, I have found that the content of a DIV is handled by the function _tag_open_WRITE() which does not consider rotations.

I have attached example code and quick-and-dirty bug-fix.

Thanks,
Andras

Example HTML code:

<style type="text/css">
<!--
table { border-collapse: collapse; }
table th { border: 1px; }
th.column_header div { rotate: 90; width: 170px; height: 20px; font-size: 3mm; text-align: left; vertical-align: top; padding: 5px 5px 5px 5px}
table td { border: 1px; font-size: 3mm; padding: 5px 5px 5px 5px }
-->
</style>
<page format="100x200" orientation="L" style="font: arial;">
<table>
<thead>
<tr>
<th class="column_header">
<div>
1. Wide and low column header
</div>
</th>
<th class="column_header">
<div>
2. Wide and low column header
</div>
</th>
</tr>
</thead>
<tr>
<td>
Value 1.1
</td>
<td>
Value 1.2
</td>
</tr>
<tr>
<td>
Value 2.1
</td>
<td>
Value 2.2
</td>
</tr>
</table>
</page>

Quick and dirty solution:
- overwrite the following two lines in html2pdf.class.php
2999: $this->_maxX = max($this->_maxX, $x+$w);
3000: $this->_maxY = max($this->_maxY, $y+$h);
- with
if ($this->parsingCss->value['rotate'] == 90 || $this->parsingCss->value['rotate'] == 270) {
$this->_maxX = $x+$w;
$this->_maxY = $y+$h;
} else {
$this->_maxX = max($this->_maxX, $x+$w);
$this->_maxY = max($this->_maxY, $y+$h);
}