Reputation: 581
For some reason TCPDF is adding space to the left when I use writeHTML()
to print an unordered list. By default, the PDF has a margin of 5 (set with $pdf->SetMargins(5, 0, 10, true);
) but list items get indented.
I set $pdf->setCellPaddings(0,0,0,0);
already, which prevents with unwanted (minus-)space for <p>
tags, but obviously doesn´t affect lists.
The call:
$pdf->writeHTML('<ul><li>...</li></li>...</li></ul>');
The result:
Is there any option I miss?
Upvotes: 13
Views: 12517
Reputation: 1913
There is a method setListIndentWidth
. For example:
$pdf->setListIndentWidth(4);
You can experiment with the value. And the documentation entry is here.
Upvotes: 32
Reputation: 1
find $this->lMargin += $this->listindent;
in tcpdf.php and replace with $this->lMargin += $this->listindent/2;
Upvotes: 0
Reputation: 1359
change:
$pdf->writeHTML('<ul><li>...</li></li>...</li></ul>');
to:
$pdf->writeHTML('<ul style="margin: 0px; padding: 0px;"><li>...</li></li>...</li></ul>');
<ul>
-Tag always adds space to the left (padding) and margin to top.
Upvotes: -3