我正在尝试创建一个页面组,虽然它不起作用。现在它正在进行第1页的第4页。我需要它按组对页面进行编号。所以总共有4页,我需要第1页的第2页,然后从2页的第1页开始。 类ManafestPrint扩展了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);
}
}
这是我的页面布局
$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');
答案 0 :(得分:0)
原来我的页码编号设置不正确。在我的标题中,我需要改变这个:
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);
}
}
到此:
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);
}