tcpdf table header in each page

Posted by DragoN on Stack Overflow See other posts from Stack Overflow or by DragoN
Published on 2012-10-07T15:35:08Z Indexed on 2012/10/07 15:37 UTC
Read the original article Hit count: 342

Filed under:
|

i am using tcpdf to create pdf files with rows of table

in the first page of pdf

i display some info like : List of table .... and header of table

after that i display the rows in table

if there much rows it contiunes in the next page without the info [List of table... and header of table]

i want to display the header of table only in the next pages here is my code

$pdf->SetFont('aefurat', '', 15);
$pdf->AddPage('P', 'A4');
$pdf->SetFontSize(17);
$pdf->Cell(0, 13, 'List of the Byan Table,'C');
$pdf->SetFont('dejavusans', '', 14);
$htmlpersian = 'In / Out List';
$pdf->WriteHTML($htmlpersian, true, 0, true, 0);
$pdf->setRTL(false);
$pdf->SetFontSize(11);
$pdf->setRTL(true);
Connect();
$resultsc = mysql_query("SELECT * FROM byan Order By Date ");
while($r = mysql_fetch_array($resultsc))
  {
$printresult .= '  <tr>
                                            <td ><center>'.$r['Date'].'</center></td>
                                            <td ><center>'.$r['In'].'</center></td>
                                            <td ><center>'.$r['Out'].'</center></td>
                                            <td ><center>'.$r['Balance'].'</center></td>
                                            <td ><center>'.$r['Info'].'</center></td>
                                             <td ><center>'.$r['Number'].'</center></td>
                                        </tr>';  

  }
$tbl = '
<table cellspacing="0" cellpadding="1" border="1" align="center">
    <tr>
                                            <td style="width: 13%; background-color:black; color:white;"><center>Date</center></td>
                                            <td style="width: 11%; background-color:black; color:white;"><center>In</center></td>
                                            <td style="width: 11%; background-color:black; color:white;"><center>Out</center></td>
                                            <td style="width: 12%; background-color:black; color:white;"><center>Balance</center></td>
                                            <td style="width: 45%; background-color:black; color:white;"><center>Info</center></td>
                                            <td style="width: 11%; background-color:black; color:white;"><center>Number</center></td>

                                        </tr>
'.$printresult.'

</table>
';

$pdf->writeHTML($tbl, true, false, true, false, '');

the output is


First Page:

List of the Byan Table

In / Out List

Table Header

rows


Second Page:

Rows


Third Page:

Rows


i want the output to be like that


First Page:

List of the Byan Table

In / Out List

Table Header

Rows


Second Page:

Table Header

Rows


Third Page:

Table Header

Rows

© Stack Overflow or respective owner

Related posts about php

Related posts about tcpdf