Not able to calculate table cells sizes

Aperta
#2,097 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 5 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
18/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
css, html, php
Ambito
backend

Direzione di ricerca

The payload names no source files, only the reproduction snippet: a five-column table with width: 100% passed to WriteHTML(). Run that snippet and check how the first column's width is computed compared with the others. Done means the columns are sized sensibly for the content and the rendered PDF shows the fix. The issue has been open 572 days with no reply and no linked pull request, so confirm the expected behaviour with maintainers first.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug/fix help wanted HTML/CSS support tables
Guidelines
Description of the bug

The first column is getting weirdly wide. I was able to achieve that with just random English letters as well.
Here you can check the preview: https://ss.v-novicov.pro/2025/03/test.pdf

mPDF version

8.2.5

PHP Version and environment (server type, cli provider etc., enclosing libraries and their respective versions)

PHP 8.3.11

Reproducible PHP+CSS+HTML snippet suffering by the error
$mpdf = new \Mpdf\Mpdf(
	array(
		'margin_top'    => 54,
		'margin_bottom' => 34,
		'margin_footer' => 10,
		'margin_left'   => 16,
		'margin_right'  => 16,
	)
);
$mpdf->SetDefaultFontSize( 8 );
$mpdf->SetDefaultFont( 'helvetica' );


ob_start();
?>
<table style="width: 100%;">
<tr>
<td><b>Première mensualité rehaussée</b></td>
<td><b>Durée</b></td>
<td><b>Valeur résiduelle</b></td>
<td><b>Maintenance</b></td>
<td><b>Tarif mensuel*</b></td>
</tr>
<tr><td>5'000.00</td><td>12 Mois</td><td>CHF 5'000.00</td><td>Non</td><td>CHF 8'536.60 (11x)</td></tr><tr><td>0.00</td><td>48 Mois</td><td>CHF 0.00</td><td>Non</td><td>CHF 2'436.75 (48x)</td></tr><tr><td>0.00</td><td>48 Mois</td><td>CHF 0.00</td><td>CHF 100.00 / Mois</td><td>CHF 2'539.00 (48x)</td></tr>
</table>

<?php
$template = ob_get_clean();

$mpdf->WriteHTML( $template );

$mpdf->Output( 'test.pdf', \Mpdf\Output\Destination::STRING_RETURN ),
Lingua principale
PHP
Stelle
4.7k
Fork
1.1k
Merge medio
6g 11h
PR unite (30g)
4

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di mpdf/mpdf

Tutte le issue di mpdf/mpdf

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.