Ich habe eine Tabelle, die dynamisch ändert. Die Tabelle kann also mehrere Seiten umfassen.TCPDF-Tabelle auf mehreren Seiten mit Rand
Ich ändere erfolgreich die Seite ohne Zeile zu brechen, aber ich habe ein Problem bezüglich der Kopfzeile des Dokuments. Die Tabelle wird auf der zweiten Seite fortgesetzt, beginnt jedoch oben, ohne den für das Logo im Dokument festgelegten Rand zu berücksichtigen.
Hier ist mein Code
$html = '<br/>
<table cellpadding="1" cellspacing="2" cellpadding="5" border="0" style="text-align:center;">
<thead>
<tr>
<th colspan="4" style="border-left:0.5px solid #1d2e5c; border-bottom:0.5px solid #1d2e5c; border-right:0.5px solid #1d2e5c;" bgcolor="#1d2e5c"><font color="#ffffff">ÉQUIPEMENTS ET LOGICIELS</font></th>
</tr>
<tr>
<th style="width:10%; border-left:0.5px solid #1d2e5c; border-bottom:0.5px solid #1d2e5c;">Qté</th>
<th style="width:50%; border-left:0.5px solid #1d2e5c; border-bottom:0.5px solid #1d2e5c;">Description</th>
<th style="width:20%; border-left:0.5px solid #1d2e5c; border-bottom:0.5px solid #1d2e5c;">Prix</th>
<th style="width:20%; border-left:0.5px solid #1d2e5c; border-bottom:0.5px solid #1d2e5c; border-right:0.5px solid #1d2e5c;">Total</th>
</tr>
</thead>';
foreach($equipements as $row) {
$quant = $row['Qte'];
$priceUnit = (ISSET($row['AutrePrix']) && $row['AutrePrix'] != 0) ? $row['AutrePrix'] : $row['Prix'];
$totalEquip = $quant * $priceUnit;
$totalAllEquip += $totalEquip;
$html .= '<tr nobr="true">
<td style="width:10%; border-left:0.5px solid #1d2e5c; border-bottom:0.5px solid #1d2e5c;">' . $quant . '</td>
<td style="width:50%; border-left:0.5px solid #1d2e5c; border-bottom:0.5px solid #1d2e5c; text-align: left;">' . $row['Nom'] . '</td>
<td style="width:20%; border-left:0.5px solid #1d2e5c; border-bottom:0.5px solid #1d2e5c; text-align: right;">' . number_format($priceUnit, 2, '.', ' ') . '<font size="-2"> $</font></td>
<td style="width:20%; border-left:0.5px solid #1d2e5c; border-bottom:0.5px solid #1d2e5c; border-right:0.5px solid #1d2e5c; text-align: right;">' . number_format($totalEquip, 2, '.', ' ') . '<font size="-2"> $</font></td>
</tr>';
}
$html .= '<tr>
<td colspan="3"></td>
<td style="width:20%; border-left:0.5px solid #1d2e5c; border-bottom:0.5px solid #1d2e5c; border-right:0.5px solid #1d2e5c; text-align: right;" bgcolor="#1d2e5c"><font color="#ffffff">' . number_format($totalAllEquip, 2, '.', ' ') . '</font><font color="#ffffff" size="-2"> $</font></td>
</tr>
</table>';
$pdf->writeHTML($html, true, false, false, false, '');
EDIT: 2016-06-01
ich die tcpdf Bibliothek verwenden: sourceforge.net/projects/tcpdf und die tcpdf_config.php Datei. Der Befehl I Kopfdaten zu setzen verwenden ist:
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
, wie Sie setzen Ihren Header-Marge noch das Logo? Vielleicht kann der Code für eine bessere Lösung helfen –
Ich benutze die tcpdf Bibliothek: https://sourceforge.net/projects/tcpdf/ und die tcpdf_config.php Datei. Der Befehl, den ich verwende, um Header-Daten zu setzen, ist: $ pdf-> SetHeaderData (PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, Array (0,64,255), Array (0,64,128)); – sincos
fügen Sie bereits $ pdf-> SetMargins hinzu (PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $ pdf-> SetHeaderMargin (PDF_MARGIN_HEADER); '? –