Problems with proof-of-concept test-case:
A. First output:
- Why is there green visible? I.e. why does the inner table get a left indent outside its parent cell? How can this be prevented? Can someone provide a proof of concept with this addressed?
- Why is there red visible? I.e. why is there spacing around the inner table cells while they have the exact same width as their parent cell? Can someone provide a proof of concept with this addressed?
B. Second output, where a page-break is within play:
- Where to start.. The page-break has some disastrous consequences. I have started working in HTML because it was claimed the page-break issue for variable content cells that should not be broken was solved and fixed, but I think this proof of concept example speaks for itself. I have added
nobrwhere I needed it, and the first output proves it is feasable to stick together. How can this be fixed?-
Also note how the left column with “row-label” gets misaligned on a new “row”
-
Also note how the order of images changes: the ones that were supposed to fit on the 1st page, get put after the page-break after the last image. Same goes for the cell to its left (from question B2).
-
Note that for my case, it is not feasable (by memory) to render in a clone first to calculate height, as we need to render 250-300mb PDFs containing hundreds of pages.
I have also verified that the units in mm are fully supported; changing it to px yields the same issues.
I have also considered using tc-lib-pdf as TCPDF is not maintained any more, but it is still only 60% complete.
Proof of concept test case code:
$pdf = new TCPDF();
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$outputTestCase = function (TCPDF $pdf, int $y) {
$pdf->AddPage();
$pdf->setY($y);
$pdf->writeHTMLCell($pdf->getPageWidth(), 0, null, null, '
<table nobr="true" style="background-color:yellow;">
<tr style="color:#f4f4f4;background-color:#0041aa;">
<td style="width:68mm;line-height:13px;"></td>
<td style="width:102mm;line-height:13px;">Header 1</td>
</tr>
<tr>
<td style="width:68mm;line-height:13px;"> </td>
<td style="width:102mm;line-height:13px;">Header 2</td>
</tr>
<tr nobr="true">
<td style="width:68mm;line-height:13px;font-size:11px;font-weight:bold;">Row-label</td>
<td style="width:102mm;line-height:13px;vertical-align:baseline;background-color:green;">
<table style="background-color:red;">
<tr><td style="width:102mm;"><img width="102mm" height="76mm" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAIAAABuYg/PAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA1SURBVFhH7c0xDQAgEAAx3LxMpIOJhoFc0r3r7HmmjCgjyogyoowoI8qIMqKMKCPKiF+zPReVflPJ9AfYpgAAAABJRU5ErkJggg=="/></td></tr>
<tr><td style="width:102mm;"><img width="102mm" height="67mm" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAABGSURBVFhH7c6hAYAwEMDAhwHYfyWmKqaa2Io7E5trvc+ag9y7xzBUDBVDxVAxVAwVQ8VQMVQMFUPFUDFUDBVDxVAx9G/mA651Ax2hOeJbAAAAAElFTkSuQmCC"/></td></tr>
<tr><td style="width:102mm;"><img width="102mm" height="68mm" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAIAAABuYg/PAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAA1SURBVFhH7c0xDQAgEAAx3LxMpIOJhoFc0r3r7HmmjCgjyogyoowoI8qIMqKMKCPKiF+zPReVflPJ9AfYpgAAAABJRU5ErkJggg=="/></td></tr>
</table>
</td>
</tr>
</table>');
};
$outputTestCase($pdf, 10);
$outputTestCase($pdf, 70);
$pdf->Output();
exit;