【发布时间】:2021-03-12 15:33:50
【问题描述】:
在 FPDF 中使用 SetY 时,内容似乎不是基于页面底部放置的。我尝试使用他们的页脚示例:
class PDF extends FPDF
{
// Page footer
function Footer()
{
// Position at 1.5 cm from bottom
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial','I',8);
// Page number
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
也只是把它放在我页面的末尾:
//Regular page content
$pdf->Cell(40,10,'Apple and iPhone are trademarks of Apple Inc., registered in the U.S. and other countries.');
//Footer content
$pdf->SetY(-15);
// Arial italic 8
$pdf->SetFont('Arial','I',8);
// Page number
$pdf->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
$pdf->Output();
但两者似乎都与pdf页面上已经加载的内容有关,而不是基于页面底部。如果页面内容为 40 行,页脚内容将加载到同一页面上。如果页面内容为 100 行,则页脚内容显示在新页面的顶部。
感谢任何输入。
【问题讨论】:
标签: fpdf