How to add contents in new page using TCPDF?

I am using TCPDF stuff, I have created a PDF page with some Information. But i need to show some data to next page deliberately.

pdf -> AddPage();

above code is used to create a new page which i know. But i wanna add specific data to this particular page would be the problem.

Help me to come out on this issue.

I have written my code like this

while($row = mysql_fetch_array($query)){

 $inv = $row["INVNUM"];
 $weight = $row["WEIGHT"];
 if($i<4){
 if($row["SIZECODE"] == "02"){
 $temp .= '<tr nobr="true">
 <td class="size1" style="border:1px solid #000">'.$json_a[$i]["S"].'</td>
 <td class="size2" style="border:1px solid #000">'.$json_a[$i]["M"].'</td>
 <td class="size3" style="border:1px solid #000">'.$json_a[$i]["L"].'</td>
 <td class="size4" style="border:1px solid #000">'.$json_a[$i]["XL"].'</td>
 <td class="size5" style="border:1px solid #000">'.$json_a[$i]["2X"].'</td>
 <td class="size6" style="border:1px solid #000">'.$json_a[$i]["3X"].'</td>
</tr>';
 }
 else if($row["SIZECODE"] == "03"){
 $temp .= '<tr>
  <td style="border:1px solid #000">'.$json_a[$i]["32"].'</td>
 <td style="border:1px solid #000">'.$json_a[$i]["34"].'</td>
 <td style="border:1px solid #000">'.$json_a[$i]["36"].'</td>
 <td style="border:1px solid #000">'.$json_a[$i]["38"].'</td>
 <td style="border:1px solid #000">'.$json_a[$i]["40"].'</td>
 <td style="border:1px solid #000">'.$json_a[$i]["42"].'</td>
</tr>';
 }

$i = $i+1;
 }
 else{
     $pdf ->AddPage();
     $i = 0;
     $temp.='<tr nobr="true">
<td colspan="18" style="border:1px solid #000">All sales are Final.</td>
<td colspan="2" style="border:1px solid #000">SUB TOTAL:</td>
 <td style="border:1px solid #000"></td>
 <td style="border:1px solid #000"></td>
</tr>
<tr>
<td colspan="18" rowspan="2" style="border:1px solid #000">Number # :   '.$rowFix["Num"].' </td>
</tr>
<tr>
<td colspan="2">TOTAL DUE: $</td>
 <td style="border:1px solid #000"></td>
 <td style="border:1px solid #000"></td>
</tr>';
 }
}

I have to bring the table rows to the next page when the $i value greater than 4.

Upvotes: 1

Views: 1952

Answers (2)

lalit mali
lalit mali

Reputation: 11

$pdf->AddPage('P', 'A4');

$pdf->Cell(0, 0, 'A4 PORTRAIT', 1, 1, 'C');

Upvotes: 1

Andrew
Andrew

Reputation: 11

First, output the content for the first page. Then:

pdf -> AddPage();

Then, output for the second page. Anything sent after this command will be outputted onto the second page.

Upvotes: 0

Related Questions