So you can, hadn't thought of the tag, thanks Nicola.
However it doesn't allow any control over the vertical alignment. There are some assumptions in tcpdf.php about sup/sub tags, line 17809, 18645 and 19185 where the y offset is hard coded.
Back to the core issue here, I appreciate that you've left this issue open as it pertains to vertical-align in general. Any estimation of how large a task it'd be to implement?
Thanks, Saul
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
nicolaasuni, what I think is that you can easily add valign property for TD and make it working only if there is only text inside TD - because you actually have valign already working for cells in tcpdf.
This will cover more then 50% of user needs, because I see almost everyones just asking this feature for text, not for combined content inside TD.
What do you think?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@gallenkamp Thanks for posting that. Interesting work around, it really is a hack, but as you say it is working for you so well done.
My original usecase, as noted here in my first comment, is for vertical-align support on inline tags (e.g. span tags) as per http://img834.imageshack.us/img834/1524/selection022.png - I've still yet to find a way to do this. So this feature request is still valid.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a table with one column having a different font size (cause the numbers are big and wouldn't stay on one line if not made smaller) and the client wants them to be vertically centered in the cells.
After trying all the hacks I have learnt in my history of HTML and CSS and TCPDF every time mocking at me I finally deviced such a clever solution which it didn't anticipateand finally got the vertical cell alignment more or less into the place ie in the middle of the cell.
I found out that if there is an image in the same cell, TCPDF aligns the text on the bottom-line of the image. So I made an utility script to serve me with a white image of parametrized width and height and put that in front of the text. One can also just make a white image of wanted dimensions and use it but I found it easier to experiment with the script and varying parameters. In my case the width is just 1px, but theoretically one could also push text to the right with the image.
Of course there are some problems with this approach as well but in my case all the numbers are quite well-behaving. If the height of either the centered text or other columns vary heavily it is very difficult to find a good value (though with parametrization one could try to calculate the height needed from the lengths of each cell on the row).
I would still prefer if there could at least be top-padding or top-margin that one could set into the cell (working vertical-align would be even more desirable but even having any tool would make life easier)
Hope this helps even some other poor coder
hank
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here's a graphic to illustrate one use case for vertical alignment:
http://img834.imageshack.us/img834/1524/selection022.png
You can get the same effect on the example using the ... tag.
So you can, hadn't thought of the tag, thanks Nicola.
However it doesn't allow any control over the vertical alignment. There are some assumptions in tcpdf.php about sup/sub tags, line 17809, 18645 and 19185 where the y offset is hard coded.
Back to the core issue here, I appreciate that you've left this issue open as it pertains to vertical-align in general. Any estimation of how large a task it'd be to implement?
Thanks, Saul
Sorry for the duplicate request, I havent seen this one.
nicolaasuni, what I think is that you can easily add valign property for TD and make it working only if there is only text inside TD - because you actually have valign already working for cells in tcpdf.
This will cover more then 50% of user needs, because I see almost everyones just asking this feature for text, not for combined content inside TD.
What do you think?
Oh, I really would like to have this feature :)
Nicolaasuni, could you possibly just write where to start digging? I could do it myself but it would be quicker if you told me where to look first.
I already have the code to look for vertical-align in css styles. I don't know where it goes next.
I solved it :)
@gallenkamp Care to share your solution? Or better yet see if it can be incorporated into TCPDF itself?
Its more a workaround than a propper solution. I'll post the workaround later today (3pm here) when I wrote it at my website, ok? Promise!
Find my solution here: http://bytethinker.com/blog/tcpdf-and-vertical-alignment-of-table-cells
@gallenkamp Thanks for posting that. Interesting work around, it really is a hack, but as you say it is working for you so well done.
My original usecase, as noted here in my first comment, is for vertical-align support on inline tags (e.g. span tags) as per http://img834.imageshack.us/img834/1524/selection022.png - I've still yet to find a way to do this. So this feature request is still valid.
I have a table with one column having a different font size (cause the numbers are big and wouldn't stay on one line if not made smaller) and the client wants them to be vertically centered in the cells.
After trying all the hacks I have learnt in my history of HTML and CSS and TCPDF every time mocking at me I finally deviced such a clever solution which it didn't anticipateand finally got the vertical cell alignment more or less into the place ie in the middle of the cell.
I found out that if there is an image in the same cell, TCPDF aligns the text on the bottom-line of the image. So I made an utility script to serve me with a white image of parametrized width and height and put that in front of the text. One can also just make a white image of wanted dimensions and use it but I found it easier to experiment with the script and varying parameters. In my case the width is just 1px, but theoretically one could also push text to the right with the image.
Of course there are some problems with this approach as well but in my case all the numbers are quite well-behaving. If the height of either the centered text or other columns vary heavily it is very difficult to find a good value (though with parametrization one could try to calculate the height needed from the lengths of each cell on the row).
I would still prefer if there could at least be top-padding or top-margin that one could set into the cell (working vertical-align would be even more desirable but even having any tool would make life easier)
Hope this helps even some other poor coder
hank