I try to make a PDF writing CSS and HTML but my CSS doesn\'t appear in my PDF. The only thing considered is the font-size and font-color.
I give you the code (sorry,
TCPDF 5.9.010 (2010-10-27) - Support for CSS properties 'border-spacing' and 'padding' for tables were added.
I recently ran into the same problem having the TCPDF work with my CSS. Take a look at the code below. It worked for me after I changed the standard CSS to a format PHP would understand
Code Sample Below
$table = '<table width="100%" cellspacing="0" cellpadding="55%">
<tr valign="bottom">
<td class="header1" rowspan="2" align="center" valign="middle"
width="6%">Category</td>
<td class="header1" rowspan="2" align="center" valign="middle"
width="26%">Project Description</td>
</tr></table>';
At the moment I write this, TCPDF only supports padding for tables.
Link to their forum page with that information
I recently ran into the same problem, and found a workaround though it'll only be useful if you can change the html code to suit.
I used tables to achieve my padded layout, so to create the equivalent of a div with internal padding I made a table with 3 columns/3 rows and put the content in the centre row/column. The first and last columns/rows are used for the padding.
eg.
<table>
<tr>
<td width="10"> </td>
<td> </td>
<td width="10"> </td>
</tr>
<tr>
<td> </td>
<td>content goes here</td>
<td> </td>
</tr>
<tr>
<td width="10"> </td>
<td> </td>
<td width="10"> </td>
</tr>
</table>
Hope that helps.
Joe