Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Putting padding between string and border in TCPDF

Tags:

php

tcpdf

How would I put padding between a string and the border to said string in TCPDF. I'm not seeing any way to do that in the Text() method.

Do I have to use another method? Is there anyway to accomplish this?

This would be an example of code I'm using:

$pdf->Text(130, $margintop, $fieldkey, false, false, true, 'B', 0, '', false, '', 0, false, 'B', 'T', false);
like image 258
Steven Matthews Avatar asked Jan 30 '14 18:01

Steven Matthews


1 Answers

TCPDF assigned default-values to the cell-paddings, which can be overwritten:

$pdf->setCellPaddings( $left = '', $top = '', $right = '', $bottom = '');

Or, with using the same padding for all sides:

$pdf->setCellPadding( $padding );

See the documentation here: http://www.tcpdf.org/doc/code/classTCPDF.html#a374b24751bf76e4ca5ba7694f87ec2c1

Update 22.04.2020: https://tcpdf.org/docs/srcdoc/TCPDF/class-TCPDF/#_SetCellPadding

Update 20.08.2020: https://tcpdf.org/docs/srcdoc-copy/TCPDF/class-TCPDF/#_SetCellPadding

like image 82
maja Avatar answered Sep 21 '22 19:09

maja