TCPDF list item margin

☆樱花仙子☆ 提交于 2020-01-02 07:23:13

问题


Couldn't find it anywhere. Having list:

<ol>
    <li>Foo</li>
    <li>Bar</li>
    <li>Baz</li>
</ol>

and CSS:

ul li, ol li{
    margin-bottom: 10px;
}

While previewing list in browser, margin-bottom is interpreted correctly. Unfortunately, TCPDF somehow doesn't recognize this style (while recognizing other parts of included css file). Is there any trick/hack to make it work?


回答1:


tcpdf allows to define the vertical spaces for HTML tags, see Method setHtmlVSpace of TCPDF Class Documentation, use:

$pdf->setHtmlVSpace(array(
    'li' => array(
        'h' => 5, // margin in mm
    ) 
));

The name of the html-Element is the key (li) and h specifies the vertical space



来源:https://stackoverflow.com/questions/27543304/tcpdf-list-item-margin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!