I’m using TCPDF to generate a PDF document, and I’m encountering an issue where there’s an unwanted padding or space at the top of the table before the first row. Here’s the relevant code and a screenshot of the issue:
$html = '
<h5 style="font-size: 12px; font-weight: bold;">Outcome Details</h5>
<table border="1" cellspacing="0" cellpadding="0" style="width: 100%; border-collapse: collapse;">
<tbody>
<tr>
<td style="width: 100px; padding: 0;">
<p style="font-size: 9px; margin: 0;">Passport Number:</p>
<p style="font-size: 9px; margin: 0;">Passport Country:</p>
<p style="font-size: 9px; margin: 0;">Visa Class:</p>
<p style="font-size: 9px; margin: 0;">Visa Granted:</p>
<p style="font-size: 9px; margin: 0;">Visa Expires:</p>
<p style="font-size: 9px; margin: 0;">Entitlements:</p>
</td>
<td style="width: 440px; padding: 0;">
<p style="font-size: 9px; margin: 0;">' . $document_number . '</p>
<p style="font-size: 9px; margin: 0;">' . $document_country . '</p>
<p style="font-size: 9px; margin: 0;">VC/' . $visa_subclass . '</p>
<p style="font-size: 9px; margin: 0;">2022-06-09+10:00</p>
<p style="font-size: 9px; margin: 0;">2024-08-30+10:00</p>
<p style="font-size: 9px; margin: 0;">' . $entitlements . '</p>
</td>
</tr>
</tbody>
</table>
';
// Output the HTML content
$pdf->writeHTML($html);
I tried adding inline style=”padding: 0px” but did not work for me.