Reputation: 3019
I have been looking through various forums but have not found a way to solve my problem.
I have a piece of HTML which I display in the view and render to PDF with TCPDF. The HTML looks fine but it does not seem to work in TCPDF.
I have the following table cell that contains text (3a-2b) and next to it the image. The alignment should be like in the second image.
PDF: Browser:
but nothing seems to work.
I know I could use the entire text as an image but this is just an example.
Is there any other way?
Upvotes: 1
Views: 17389
Reputation: 441
Adding style="line-height:50%;" in image tag works for me. Please give this a try. In my case, I wanted to vertical align image in table cell. You can add div in table cell and can add image or text inside it. Below works for me.
<div align="center"><img src="images/logo_example.png" border="0" height="30" width="30" style="line-height:50%;"/></div>
Upvotes: 1
Reputation: 3019
Putting the text and the image in a separate <td>
and applying a line-height
of 6px to the <td>
containing the text did the trick.
Upvotes: 3
Reputation: 3363
TCPDF supports HTML and CSS very poorly, but there are some undocumented HTML and CSS attributes. Searching the sourcecode I found an "aling" attribute for the img tag supporting "middle". So this could do what you want:
<img src="..." align="middle">
Upvotes: -1