我正在使用 TCPDF 来呈现通过一系列 HTML 表格生成的一些报告。这些表包含一些我想从 Footer() 方法解析并添加到当前页面页脚的跟踪代码。知道如何从 TCPDF 获取当前页面的 html 代码吗?
我基本上是这样做的:
class SVNPDF extends TCPDF {
// Page footer
public function Footer() {
// Position at 15 mm from bottom
$this->SetY(-15);
// Set font
$this->SetFont('helvetica', 'I', 10);
// Page number
$this->Cell(0, 10, 'Page '.$this->getAliasNumPage().'/'.$this->getAliasNbPages(), 0, false, 'R', 0, '', 0, false, 'T', 'M');
$this->SetY(-15);
$this->SetFont('helvetica', 'I', 10);
$this->Cell(0, 10, 'Picking #'.$glb_picking_num.'', 0, false, 'L', 0, '', 0, false, 'T', 'M');
// HERE I NEED TO RETRIEVE CURRENT PAGE HTML CONTENT AND EXTRACT THE TRACKING NUMBER INSIDE FOR DISPLAY IN CURRENT FOOTER
}
}
$report = 'SOME LONG HTML CODE HERE';
$pdf = new SVNPDF('L', 'mm', 'A4', true, 'UTF-8', false);
$pdf->AddPage();
$pdf->writeHTML($report, true, false, true, false, '');
$pdf->Output(dirname(__FILE__) . '/test.pdf', 'I');