I am trying to do a page group, Although it is not working. Right now it is doing page 1 of 4. I need it to number the pages by group. So there will be a total of 4 pages and I need page 1 of 2 then to start over page 1 of 2. class ManafestPrint extends TCPDF {
//Page header
public function Header()
{
global $pickUpDate;
// Set font
$this->SetFont('helvetica', 'B', 20);
// Title
$titleHTML = '
<table width="100%" border="0" style="font-weight: bold; font-size: 9pt;">
<tr>
<td width="25%" align="left">PICK UP DATE: '.$pickUpDate.'</td>
<td width="50%" align="center" style="font-size: 16pt;">SHIPPING MANIFEST</td>
<td width="25%" align="right">Page '.$this->getAliasNumPage().' of '.$this->getAliasNbPages().'</td>
</tr>
</table>
';
$this->writeHTMLCell(280, 25, 7, 5, $titleHTML);
}
}
This is my page layout
$pdf = new ManifestPrint('L', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetMargins(0, 12, 0);
$pdf->SetAutoPageBreak(true, 10);
$pdf->startPageGroup();
$pdf->AddPage();
$pdf->writeHTMLCell(280, 0, 5, 15, $shipperCarierData, 0, 0, false, true, 'C', true);
$pdf->writeHTMLCell(280, 0, 3, 35, $tableData, 0, 0, false, true, 'C', true);
$pdf->AddPage();
$pdf->lastPage();
$pdf->writeHTMLCell(280, 0, 5, 160, $disclaimerHTML, 0, 0, false, true, 'C', true);
$pdf->startPageGroup();
$pdf->AddPage();
$pdf->writeHTMLCell(280, 0, 5, 15, $shipperCarierData1, 0, 0, false, true, 'C', true);
$pdf->writeHTMLCell(280, 0, 3, 35, $tableData1, 0, 0, false, true, 'C', true);
$pdf->AddPage();
$pdf->lastPage();
$pdf->writeHTMLCell(280, 0, 5, 160, $disclaimerHTML, 0, 0, false, true, 'C', true);
$pdf->Output('print_manifest.pdf', 'I');
Turns out my page numbering was set up incorrectly. In my header I needed to change this:
public function Header()
{
global $pickUpDate;
// Set font
$this->SetFont('helvetica', 'B', 20);
// Title
$titleHTML = '
<table width="100%" border="0" style="font-weight: bold; font-size: 9pt;">
<tr>
<td width="25%" align="left">PICK UP DATE: '.$pickUpDate.'</td>
<td width="50%" align="center" style="font-size: 16pt;">SHIPPING MANIFEST</td>
<td width="25%" align="right">Page '.$this->getAliasNumPage().' of '.$this->getAliasNbPages().'</td>
</tr>
</table>
';
$this->writeHTMLCell(280, 25, 7, 5, $titleHTML);
}
}
to this:
public function Header()
{
global $pickUpDate;
// Set font
$this->SetFont('helvetica', 'B', 20);
// Title
$titleHTML = '
<table width="100%" border="0" style="font-weight: bold; font-size: 9pt;">
<tr>
<td width="25%" align="left">PICK UP DATE: '.$pickUpDate.'</td>
<td width="50%" align="center" style="font-size: 16pt;">SHIPPING MANIFEST</td>
<td width="25%" align="right">Page '.$this->getPageNumGroupAlias().' of '.$this->getPageGroupAlias().'</td>
</tr>
</table>
';
$this->writeHTMLCell(280, 25, 7, 5, $titleHTML);
}