TCPDF not render all CSS properties

后端 未结 10 1820
不思量自难忘°
不思量自难忘° 2020-12-05 09:15

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,

相关标签:
10条回答
  • 2020-12-05 10:14

    TCPDF 5.9.010 (2010-10-27) - Support for CSS properties 'border-spacing' and 'padding' for tables were added.

    0 讨论(0)
  • 2020-12-05 10:14

    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>';
    
    0 讨论(0)
  • 2020-12-05 10:16

    At the moment I write this, TCPDF only supports padding for tables.

    Link to their forum page with that information

    0 讨论(0)
  • 2020-12-05 10:22

    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">&nbsp;</td>
        <td>&nbsp;</td>
        <td width="10">&nbsp;</td>
    </tr>
    <tr>
        <td>&nbsp;</td>
        <td>content goes here</td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td width="10">&nbsp;</td>
        <td>&nbsp;</td>
        <td width="10">&nbsp;</td>
    </tr>
    </table>
    

    Hope that helps.

    Joe

    0 讨论(0)
提交回复
热议问题