I am printing a cell using the TCPDF(http://www.tcdf.org/) class in php. The cell should be placed into the top left corner.
Everything works great, except that a left and top padding is added inside the cell.
Here is my code:
require_once('../config/lang/eng.php');
require_once('../tcpdf.php');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetMargins(0,0,0);
$pdf->SetAutoPageBreak(0,0);
$pdf->SetFont('dejavusans', '', 8.5, '', true);
$pdf->AddPage('L', array(50.8,88.9));
$pdf->SetDisplayMode(100,'default');
$pdf->SetXY(0, 0);
$pdf->Cell(0,2.98740833, "Your Name", '1', 2, 'L', false); //Name
$pdf->Output('example.pdf', 'I');
Here's a screenshot of the PDF that is outputting with TCPDF:
Here's a screenshot of the same cell at 300% magnification:
How can I remove the unwanted padding?
///EDIT///
I managed to remove the left padding by using the setCellPaddings() function:
$pdf->setCellPaddings(0,0,0,0);
I am however still getting padding above and below the text within the cell:
I can increase the size of the cell, but when I try to make the height of the cell smaller to try and close it in on the text, the cell won't get any smaller than the current size. How can I decrease the height of the cell or remove the unwanted top and bottom padding of the cell?
If I'm not mistaken, that it is not padding, but space for letters which extend below the baseline (e.g. "g"), accents, subscripts and superscripts.
I tried your code with some accented letters in the text. This is the result:
Relevant:
- Baseline (typography)
- Subscript & Superscript