By default, the values within tables cells (within tables generated by TCPDF) are vertically aligned right at the top of the cell.
Has anyone found a simple method for vertically aligning text to the middle of the cell?
I have found a couple of proposed solutions online but these don't strike me as ideal.
For example one suggestion (http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/4385696) is to set the contents of each cell using TCPDF's MultiCell() method, but this is a pain when you simply want to write out your HTML code and then generate the PDF.
Another suggestion (http://bytethinker.com/blog/tcpdf-and-vertical-alignment-of-table-cells) is to place spans within each cell and create blank lines with line breaks in these spans in order to force your text down (and thus towards the vertical centre), but this is a bit of a hack.
Has anyone found a better / cleaner way to achieve this? Surely a library this popular would cater for such a common requirement?
Remember that TCPDF cannot handle full-blown HTML and CSS the way a browser can. Nicolas has done a good job of rendering the most-used HTML codes. CSS cannot be placed at the top of the document, it must be put inline.
Tables must be formatted completely manually--cells do not auto-size the way they do in a browser. Likewise, you must figure out how tall something is and add <BR>
s or size an invisible image to push it down if you want.
Perhaps one day he will add more of this functionality. As it is, I find the class amazing.