Hi
I am also using the writeHtml function in a recent project and found drawing lines at calculated positions was not a real option to me. so I have created a little hack to enable 1px black borders to tr td div tags.
you need to make two changes to tcpdf Class (or override writeHtml function in yout own pdf class inheriting from tcpdf):
So just look for the following:
if (isset($dom[$key]['content'])) {
$cell_content = $dom[$key]['content'];
} else {
$cell_content = ' ';
}
after that include:
if (isset($dom[$key]['attribute']['border'])) {
$cell_borderHack = $dom[$key]['attribute']['border'];
} elseif (isset($dom[$trid]['attribute']['border'])) {
$cell_borderHack = $dom[$trid]['attribute']['border'];
} else {
$cell_borderHack = false;
}
and then find:
$this->MultiCell($cellw, $cellh, $cell_content, false, $lalign, false, 2, '', '', true, 0, true);
and replace it with:
$this->MultiCell($cellw, $cellh, $cell_content, $cell_borderHack, $lalign, false, 2, '', '', true, 0, true);
After you have done these changes it becomes possible to define top Left rigt bottom Borders
just by putting a combination of "TRBL" into the border attribute of your html-tag.
e.g.:
-> will render the top and left Border 1px solid Black to this table cell.
I know this is far from being valid HTML :J but it saved me a lot of time and trouble.
It should also be mentioned that there is a very good reason not going for dompdf due to lack of utf-8 support it will get you into even bigger trouble especially if you are generating Pdf from a multilingual database which I assume.
Tcpdf is the only php library I know that handles utf-8 without any problems (please correct me if I'm wrong in this case).