Vertical middle align text in a cell for TCPDF

TCPDF library is one of the recommended libraries to convert html to PDF. It supports most of the styles but not all. Today I came along such an issue. When I was giving a height to the td tag then the text was getting top aligned. I tried with valign=“middle” but no luck. After googling found that valign is not yet supported. But I was desperate to have the design so after a bit of hit and trial able to fix it.
I changed the code from

<td style="height: 30px" valign="middle">Your text</td>
to
<td style="height: 30px; line-height: 3px">Your text</td>

This is the same procedure we used to implement to middle align texts in divs. Its generally recommended that line-height = height / 2. But for this TCPDF case it did not work and setting 3px worked for me. So if anyone comes across such an issue then tinker with line-height and I think it will solve the problem.