views:

311

answers:

1

Is it possible to make nested table fit height of its parent cell in TCPDF?

My code:

<?php
require_once('tcpdf/config/lang/eng.php');
require_once('tcpdf/tcpdf.php');

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);

$pdf->SetFont('times', 'BI', 8);

$pdf->AddPage();

$pdf->writeHTML('<table>
    <tr><td bgcolor="gray"> Angoisse et vif espoir, sans humeur factieuse.<br/>
Plus allait se vidant le fatal sablier,<br/>
Plus ma torture était âpre et délicieuse;<br/>
Tout mon coeur s’arrachait au monde familier</td>
    <td bgcolor="lightgray">Second</td>
    <td bgcolor="gray">Third</td>
    <td>
        <table style="height: 100%">
            <tr bgcolor="blue" style="height: 30%"><td bgcolor="yellow" style="height: 30%">Ichi</td></tr>
            <tr bgcolor="white" style="height: 30%"><td bgcolor="cyan" style="height: 30%">Ni</td></tr>
            <tr bgcolor="blue" style="height: 30%"><td bgcolor="yellow" style="height: 30%">San</td></tr>
        </table>
    </td></tr>
</table>');

$pdf->Output('example_002.pdf', 'I');
?>

I want table in last cell to fill it entirely. Is there any way to do this?

A: 

Well, it seems the only way is not to use WriteHTML, but to write table as sequence of cells.

Kuroki Kaze
Solved it by using cells.
Kuroki Kaze