In version 3b, when you have a nested table, it wouldn't
show the first (nested) table. I didn't found out, why it
does, but I made a workaround.
The workaround adds an (empty) table before the first
nested table. This table wil not be rendered, but the
second (was first) nested table will be shown.
-------------- CODE ---------------
//Match a nested table
$regexp = '#(<td[^>]*>)(((?!/td).)*)(<table)#siU';
//Add an empty table, to work around the "first table bug"
$html = preg_replace($regexp, '\\1<table border="0"
cellpadding="0" cellspacing="0" width="0"
height="0"><tr><td></td></tr></table>\\2\\4', $html);
----------------------------------------
At this in before you call $pdf->WriteHTML($html);
Any comments, improvements etc. are welcome.
Renso Lohuis
Logged In: YES
user_id=622896
Well said in that this is a *WORKAROUND*
The true way to support massively nested tables and solve
the style problems at the same time, is to construct a
DOCUMENT OBJECT MODEL (xml-like)
It doesn't have to be XML 1.0 compliant nor stuff like that.
Split html2fpdf in two:
a) The Parser
This constructs a tree model of the document. And each node
will have its getstyle() function which calls the parent /
etc. This will make sure that no style overflows (like a
SPAN tag inside td's)
b) The printer.
This just traverses the document tree and is nearly
identical to current html2fpdf . The difference is, you
don't have to recalculate margins / paddings, nor have to
deal with closing tags anymore. It's just nodes inside nodes.
I suggest the author to begin this conversion stage so we
can get rid of the style bugs.