问题
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